chardev: move headers to include/chardev
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 26 Jan 2017 13:19:46 +0000 (17:19 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 2 Jun 2017 07:33:52 +0000 (11:33 +0400)
So they are all in one place. The following patch will move serial &
parallel declarations to the respective headers.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
106 files changed:
MAINTAINERS
backends/baum.c
backends/msmouse.c
backends/rng-egd.c
backends/testdev.c
backends/wctablet.c
chardev/char-console.c
chardev/char-fd.c
chardev/char-fd.h [deleted file]
chardev/char-file.c
chardev/char-io.c
chardev/char-io.h [deleted file]
chardev/char-mux.c
chardev/char-mux.h [deleted file]
chardev/char-null.c
chardev/char-parallel.c
chardev/char-parallel.h [deleted file]
chardev/char-pipe.c
chardev/char-pty.c
chardev/char-ringbuf.c
chardev/char-serial.c
chardev/char-serial.h [deleted file]
chardev/char-socket.c
chardev/char-stdio.c
chardev/char-udp.c
chardev/char-win-stdio.c
chardev/char-win-stdio.h [deleted file]
chardev/char-win.c
chardev/char-win.h [deleted file]
chardev/char.c
gdbstub.c
hmp.c
hw/arm/fsl-imx25.c
hw/arm/fsl-imx31.c
hw/arm/fsl-imx6.c
hw/arm/omap2.c
hw/arm/pxa2xx.c
hw/arm/strongarm.c
hw/bt/hci-csr.c
hw/char/cadence_uart.c
hw/char/debugcon.c
hw/char/digic-uart.c
hw/char/escc.c
hw/char/etraxfs_ser.c
hw/char/exynos4210_uart.c
hw/char/grlib_apbuart.c
hw/char/ipoctal232.c
hw/char/lm32_juart.c
hw/char/lm32_uart.c
hw/char/mcf_uart.c
hw/char/milkymist-uart.c
hw/char/omap_uart.c
hw/char/parallel.c
hw/char/pl011.c
hw/char/sclpconsole-lm.c
hw/char/sclpconsole.c
hw/char/serial.c
hw/char/sh_serial.c
hw/char/spapr_vty.c
hw/char/terminal3270.c
hw/char/virtio-console.c
hw/char/xen_console.c
hw/char/xilinx_uartlite.c
hw/core/qdev-properties-system.c
hw/core/qdev-properties.c
hw/ipmi/ipmi_bmc_extern.c
hw/isa/pc87312.c
hw/mips/boston.c
hw/misc/ivshmem.c
hw/usb/ccid-card-passthru.c
hw/usb/dev-serial.c
hw/usb/redirect.c
hw/virtio/vhost-user.c
hw/xen/xen-common.c
hw/xtensa/xtfpga.c
include/chardev/char-fd.h [new file with mode: 0644]
include/chardev/char-io.h [new file with mode: 0644]
include/chardev/char-mux.h [new file with mode: 0644]
include/chardev/char-parallel.h [new file with mode: 0644]
include/chardev/char-serial.h [new file with mode: 0644]
include/chardev/char-win-stdio.h [new file with mode: 0644]
include/chardev/char-win.h [new file with mode: 0644]
include/chardev/char.h [new file with mode: 0644]
include/hw/char/bcm2835_aux.h
include/hw/char/cadence_uart.h
include/hw/char/digic-uart.h
include/hw/char/imx_serial.h
include/hw/char/serial.h
include/hw/char/stm32f2xx_usart.h
include/sysemu/char.h [deleted file]
monitor.c
net/colo-compare.c
net/filter-mirror.c
net/slirp.c
net/vhost-user.c
qmp.c
qtest.c
replay/replay-char.c
slirp/slirp.c
spice-qemu-char.c
tests/postcopy-test.c
tests/test-char.c
tests/vhost-user-test.c
ui/console.c
ui/gtk.c
vl.c

index 7df088259b210d9a10c4e0700869f7828bf60914..48e2964ed88f64e31ff35a9123b9ed29b3693533 100644 (file)
@@ -1238,6 +1238,7 @@ M: Paolo Bonzini <pbonzini@redhat.com>
 M: Marc-André Lureau <marcandre.lureau@redhat.com>
 S: Maintained
 F: chardev/
+F: include/chardev/
 F: backends/msmouse.c
 F: backends/testdev.c
 
index 2eddcae119966d3cfba7e9d208a12aa3fc510368..302dd9666c0595bb25a1b8584fef1456f5838858 100644 (file)
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/timer.h"
 #include "hw/usb.h"
 #include "ui/console.h"
index d2c3162f1ed616b18f2ce8d6796acfc61244177c..0ffd137ce8eade2dc6bb1864cbd2edaf1b315147 100644 (file)
@@ -23,7 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "ui/console.h"
 #include "ui/input.h"
 
index 380b19a0a126c50550c5277ad2523d72b2688ad2..5448f6e5f5c2c8cd448969e862f970df8f561b4a 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "sysemu/rng.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 
index 7df9248a1389e0bcebeee3890c6788a2b1f9a7d5..031e9a23e8b4e5d51b41e241a4671cd4fdaa413c 100644 (file)
@@ -25,7 +25,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #define BUF_SIZE 32
 
index a4d3ae098ad94c48d3ed68cf27c77d0f84592510..07a4cde956de36132230f96bde19fdf57b9deae9 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "ui/console.h"
 #include "ui/input.h"
 #include "trace.h"
index 8d972c150690a45961611eb62ed8aa6b8c8bf81d..535ed65136c693ab0e0fb53f248c9b3b575578d4 100644 (file)
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "char-win.h"
+#include "chardev/char-win.h"
 
 static void qemu_chr_open_win_con(Chardev *chr,
                                   ChardevBackend *backend,
index 0b182c552c4e5705dfe73a1517372c21d2b346bd..1584a3de20101dc4c826ddf5240680f6c7714e0a 100644 (file)
 #include "qemu/sockets.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "io/channel-file.h"
 
-#include "char-fd.h"
-#include "char-io.h"
+#include "chardev/char-fd.h"
+#include "chardev/char-io.h"
 
 /* Called with chr_write_lock held.  */
 static int fd_chr_write(Chardev *chr, const uint8_t *buf, int len)
diff --git a/chardev/char-fd.h b/chardev/char-fd.h
deleted file mode 100644 (file)
index d832798..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef CHAR_FD_H
-#define CHAR_FD_H
-
-#include "io/channel.h"
-#include "sysemu/char.h"
-
-typedef struct FDChardev {
-    Chardev parent;
-    Chardev *chr;
-    QIOChannel *ioc_in, *ioc_out;
-    int max_size;
-} FDChardev;
-
-#define TYPE_CHARDEV_FD "chardev-fd"
-
-#define FD_CHARDEV(obj) OBJECT_CHECK(FDChardev, (obj), TYPE_CHARDEV_FD)
-
-void qemu_chr_open_fd(Chardev *chr, int fd_in, int fd_out);
-int qmp_chardev_open_file_source(char *src, int flags, Error **errp);
-
-#endif /* CHAR_FD_H */
index aed4ae15693315ade0a501bbde421c44720b7603..a57b88aaf2bd7eee75705900f920468231cf98f1 100644 (file)
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #ifdef _WIN32
-#include "char-win.h"
+#include "chardev/char-win.h"
 #else
-#include "char-fd.h"
+#include "chardev/char-fd.h"
 #endif
 
 static void qmp_chardev_open_file(Chardev *chr,
index b5708eef456d3e2224b499770284b60875a06c69..f81052481a557f660ab162a7dd59e52cb0eead33 100644 (file)
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "char-io.h"
+#include "chardev/char-io.h"
 
 typedef struct IOWatchPoll {
     GSource parent;
diff --git a/chardev/char-io.h b/chardev/char-io.h
deleted file mode 100644 (file)
index 55973a7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef CHAR_IO_H
-#define CHAR_IO_H
-
-#include "qemu-common.h"
-#include "io/channel.h"
-#include "sysemu/char.h"
-
-/* Can only be used for read */
-GSource *io_add_watch_poll(Chardev *chr,
-                        QIOChannel *ioc,
-                        IOCanReadHandler *fd_can_read,
-                        QIOChannelFunc fd_read,
-                        gpointer user_data,
-                        GMainContext *context);
-
-void remove_fd_in_watch(Chardev *chr);
-
-int io_channel_send(QIOChannel *ioc, const void *buf, size_t len);
-
-int io_channel_send_full(QIOChannel *ioc, const void *buf, size_t len,
-                         int *fds, size_t nfds);
-
-#endif /* CHAR_IO_H */
index 37d42c65c63d28e98d241538bf9352c1fee220d6..106c682e7ff162a504e045fa7840819607d3e3db 100644 (file)
@@ -24,9 +24,9 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/block-backend.h"
-#include "char-mux.h"
+#include "chardev/char-mux.h"
 
 /* MUX driver for serial I/O splitting */
 
diff --git a/chardev/char-mux.h b/chardev/char-mux.h
deleted file mode 100644 (file)
index 3f41dfc..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef CHAR_MUX_H
-#define CHAR_MUX_H
-
-#include "sysemu/char.h"
-
-extern bool muxes_realized;
-
-#define MAX_MUX 4
-#define MUX_BUFFER_SIZE 32 /* Must be a power of 2.  */
-#define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1)
-typedef struct MuxChardev {
-    Chardev parent;
-    CharBackend *backends[MAX_MUX];
-    CharBackend chr;
-    int focus;
-    int mux_cnt;
-    int term_got_escape;
-    int max_size;
-    /* Intermediate input buffer catches escape sequences even if the
-       currently active device is not accepting any input - but only until it
-       is full as well. */
-    unsigned char buffer[MAX_MUX][MUX_BUFFER_SIZE];
-    int prod[MAX_MUX];
-    int cons[MAX_MUX];
-    int timestamps;
-
-    /* Protected by the Chardev chr_write_lock.  */
-    int linestart;
-    int64_t timestamps_start;
-} MuxChardev;
-
-#define MUX_CHARDEV(obj) OBJECT_CHECK(MuxChardev, (obj), TYPE_CHARDEV_MUX)
-#define CHARDEV_IS_MUX(chr)                             \
-    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
-
-void mux_chr_set_handlers(Chardev *chr, GMainContext *context);
-void mux_set_focus(Chardev *chr, int focus);
-void mux_chr_send_all_event(Chardev *chr, int event);
-
-#endif /* CHAR_MUX_H */
index dc0d68ab2dd971cc2d7e973d3170523cbae77e2e..90bafe76f43660f70b12fef4e972f23d19c03707 100644 (file)
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 static void null_chr_open(Chardev *chr,
                           ChardevBackend *backend,
index 3fa22ce29d4520c8afb2391d028c3189e9287f17..bce89f8c36180d97e106e7946170c966f7309603 100644 (file)
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qapi/error.h"
 #include <sys/ioctl.h>
 
@@ -41,8 +41,8 @@
 #endif
 #endif
 
-#include "char-fd.h"
-#include "char-parallel.h"
+#include "chardev/char-fd.h"
+#include "chardev/char-parallel.h"
 
 #if defined(__linux__)
 
diff --git a/chardev/char-parallel.h b/chardev/char-parallel.h
deleted file mode 100644 (file)
index 26742f9..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef CHAR_PARALLEL_H
-#define CHAR_PARALLEL_H
-
-#if defined(__linux__) || defined(__FreeBSD__) || \
-    defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-#define HAVE_CHARDEV_PARPORT 1
-#endif
-
-#endif /* CHAR_PARALLEL_H */
index aae950a22b7ecfd4b9e5996a7197966393bb2b19..3a95e4c1b2ab6d587a3447c3e799a8bf0250f9b5 100644 (file)
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #ifdef _WIN32
-#include "char-win.h"
+#include "chardev/char-win.h"
 #else
-#include "char-fd.h"
+#include "chardev/char-fd.h"
 #endif
 
 #ifdef _WIN32
index 35a175d796f17757ca744ed6c72e68beb2c57b79..e5d20a0e6a8454263630f8e9f41268fbf931f90f 100644 (file)
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "io/channel-file.h"
 #include "qemu/sockets.h"
 #include "qemu/error-report.h"
 
-#include "char-io.h"
+#include "chardev/char-io.h"
 
 #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)      \
     || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
index d130069e8886f79fce593246d21dd7462da2b0ee..df52b04d2295c1298e97f951470c1bc796529f31 100644 (file)
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qmp-commands.h"
 #include "qemu/base64.h"
 
index fef3a91c7747b4c09ac3008678261b09bc5f5dbf..2f8f83821da5ed3d0d489848c4fdc20234f47070 100644 (file)
 #include "qapi/error.h"
 
 #ifdef _WIN32
-#include "char-win.h"
+#include "chardev/char-win.h"
 #else
 #include <sys/ioctl.h>
 #include <termios.h>
-#include "char-fd.h"
+#include "chardev/char-fd.h"
 #endif
 
-#include "char-serial.h"
+#include "chardev/char-serial.h"
 
 #ifdef _WIN32
 
diff --git a/chardev/char-serial.h b/chardev/char-serial.h
deleted file mode 100644 (file)
index 64a27f6..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef CHAR_SERIAL_H
-#define CHAR_SERIAL_H
-
-#ifdef _WIN32
-#define HAVE_CHARDEV_SERIAL 1
-#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
-    || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
-    || defined(__GLIBC__)
-#define HAVE_CHARDEV_SERIAL 1
-#endif
-
-#endif
index e2fb7f7cd571eeef2cc276028183d4aaefc01900..ccc499cfa1e29c31c70c9f4b811ede0ee2951d49 100644 (file)
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "io/channel-socket.h"
 #include "io/channel-tls.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qapi/clone-visitor.h"
 
-#include "char-io.h"
+#include "chardev/char-io.h"
 
 /***********************************************************/
 /* TCP Net console */
index be4a65962c2264f043fbd0996d0bf863bd34d857..6f5d798d7b7735c54a88d3418ae0e6cb45b1869a 100644 (file)
 #include "qemu/sockets.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #ifdef _WIN32
-#include "char-win.h"
-#include "char-win-stdio.h"
+#include "chardev/char-win.h"
+#include "chardev/char-win-stdio.h"
 #else
 #include <termios.h>
-#include "char-fd.h"
+#include "chardev/char-fd.h"
 #endif
 
 #ifndef _WIN32
index 607647642ae9b9853990f5ed414f5aadea7ba2ca..4ee11d3ebf15219d2627dd0fda21ea362f7dec5b 100644 (file)
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "io/channel-socket.h"
 #include "qapi/error.h"
 
-#include "char-io.h"
+#include "chardev/char-io.h"
 
 /***********************************************************/
 /* UDP Net console */
index eb44afc17abab31cb9fb28fdf6f6b16467098ef4..efcf7827eb026bcd671f7c3889dc96dff4291a9b 100644 (file)
@@ -23,8 +23,8 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "char-win.h"
-#include "char-win-stdio.h"
+#include "chardev/char-win.h"
+#include "chardev/char-win-stdio.h"
 
 typedef struct {
     Chardev parent;
diff --git a/chardev/char-win-stdio.h b/chardev/char-win-stdio.h
deleted file mode 100644 (file)
index d7314f7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef CHAR_WIN_STDIO_H
-#define CHAR_WIN_STDIO_H
-
-#define TYPE_CHARDEV_WIN_STDIO "chardev-win-stdio"
-
-#endif /* CHAR_WIN_STDIO_H */
index ec9a731be95305c96cb1f9df2cc495d2cc2bc05b..05518e095822c2a7ec97192e0ea6802d31eb8fbf 100644 (file)
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qapi/error.h"
-#include "char-win.h"
+#include "chardev/char-win.h"
 
 static void win_chr_read(Chardev *chr, DWORD len)
 {
diff --git a/chardev/char-win.h b/chardev/char-win.h
deleted file mode 100644 (file)
index 4994425..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * QEMU System Emulator
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef CHAR_WIN_H
-#define CHAR_WIN_H
-
-#include "sysemu/char.h"
-
-typedef struct {
-    Chardev parent;
-
-    bool keep_open; /* console do not close file */
-    HANDLE file, hrecv, hsend;
-    OVERLAPPED orecv;
-    BOOL fpipe;
-
-    /* Protected by the Chardev chr_write_lock.  */
-    OVERLAPPED osend;
-} WinChardev;
-
-#define NSENDBUF 2048
-#define NRECVBUF 2048
-
-#define TYPE_CHARDEV_WIN "chardev-win"
-#define WIN_CHARDEV(obj) OBJECT_CHECK(WinChardev, (obj), TYPE_CHARDEV_WIN)
-
-void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open);
-int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp);
-int win_chr_pipe_poll(void *opaque);
-
-#endif /* CHAR_WIN_H */
index 26607c1c6ba775a03e1ccc4d757df686b1696c7f..02142b480edb434abc9c44afae77817f66bb65f4 100644 (file)
 #include "sysemu/sysemu.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qmp-commands.h"
 #include "qapi-visit.h"
 #include "sysemu/replay.h"
 #include "qemu/help_option.h"
 
-#include "char-mux.h"
-#include "char-io.h"
-#include "char-parallel.h"
-#include "char-serial.h"
+#include "chardev/char-mux.h"
+#include "chardev/char-io.h"
+#include "chardev/char-parallel.h"
+#include "chardev/char-serial.h"
 
 /***********************************************************/
 /* character device */
index 86eed4f97c72481798ea5c6579ac6278b44c8976..6515c635dcae323c4eed6a0624925e0ec9cf1ac3 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -25,7 +25,7 @@
 #include "qemu.h"
 #else
 #include "monitor/monitor.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/sysemu.h"
 #include "exec/gdbstub.h"
 #endif
diff --git a/hmp.c b/hmp.c
index 20f5daba5e042ebc6993c633980bd9a88d1b518d..97d4822e52bbb9aa4e0d560697af434782710afa 100644 (file)
--- a/hmp.c
+++ b/hmp.c
@@ -17,7 +17,7 @@
 #include "hmp.h"
 #include "net/net.h"
 #include "net/eth.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/sysemu.h"
 #include "qemu/config-file.h"
index 9056f27bf800b607025223acc282d6259a99d159..40666b68a30ef8ad84aefdefbdc671bcdf3fefce 100644 (file)
@@ -30,7 +30,7 @@
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
 #include "hw/boards.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 static void fsl_imx25_init(Object *obj)
 {
index d7e2d832b226453c00dfffcf2a386046c5d70ebe..c30130667e824907effaf7fb12f2b7b86b12634e 100644 (file)
@@ -27,7 +27,7 @@
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
 #include "hw/boards.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 static void fsl_imx31_init(Object *obj)
 {
index 6969e734adc840ccd98104745cc4c06aa0ca0597..27773c9c47599fcf242892d890a4db5a8d21f70e 100644 (file)
@@ -24,7 +24,7 @@
 #include "qemu-common.h"
 #include "hw/arm/fsl-imx6.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/error-report.h"
 
 #define NAME_SIZE 20
index 8afb854c740c71a45fb71c429eeb0af1f6f0f137..9eabbaeea52f51dd7c6d7d638d509903733e6a31 100644 (file)
@@ -30,7 +30,7 @@
 #include "hw/arm/omap.h"
 #include "sysemu/sysemu.h"
 #include "qemu/timer.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/block/flash.h"
 #include "hw/arm/soc_dma.h"
 #include "hw/sysbus.h"
index eea551dc166b73b2a1ebf2bb3130c5796a46a304..0d43cc707c09a2bc104731156e7c392c57d13e6e 100644 (file)
@@ -17,7 +17,7 @@
 #include "hw/char/serial.h"
 #include "hw/i2c/i2c.h"
 #include "hw/ssi/ssi.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "qemu/cutils.h"
index 3311cc38a4778379ff628666db45f60b027860f3..66cad198d4b864f7ab0012eacfa1f439a9797fd2 100644 (file)
@@ -34,7 +34,7 @@
 #include "strongarm.h"
 #include "qemu/error-report.h"
 #include "hw/arm/arm.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/sysemu.h"
 #include "hw/ssi/ssi.h"
 #include "qemu/cutils.h"
index 3c193848fce8934f67ea77aa21f9308b913d20ee..cc2087392ef55de811048febd1d1db5b7972b0c9 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/timer.h"
 #include "qemu/bswap.h"
 #include "hw/irq.h"
index 4dcee571c0f9f32a67e3e3db0f703e539bd8b172..cf4c1d56ff338d7ac8b153c8871bcbed3fcc3528 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/timer.h"
 #include "qemu/log.h"
 #include "hw/char/cadence_uart.h"
index 80dce07e7f106582ad86e2535b671221bb7fb58e..77d91c85585f59b1d6a4f20c13dbbfae8dc43c8c 100644 (file)
@@ -27,7 +27,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
 
index 029f5bbf5eeba0fe666164a6e0dc4dfc3e453f1e..4f1dec7f1d9958e9fccd057f0716c406c621f889 100644 (file)
@@ -29,7 +29,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/log.h"
 
 #include "hw/char/digic-uart.h"
index 9228091cecae5005fabbf2d369ea0fd64738201f..df89d58eedd54ff6f6d1e30fe0bb30d541f8d790 100644 (file)
@@ -26,7 +26,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/char/escc.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "ui/console.h"
 #include "ui/input.h"
 #include "trace.h"
index 54383878e03d9ed880e0379877d0ef4667da1aae..33e3e163972ebf63f9ae36a20feeded121551c92 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/log.h"
 
 #define D(x)
index bff706ab3a68ad49db6bf963b4a23cee2ef0a556..94952fb90f02cb79fc32cc594a2b8c622bcf9bce 100644 (file)
@@ -23,7 +23,7 @@
 #include "hw/sysbus.h"
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #include "hw/arm/exynos4210.h"
 
index db686e6a6fdcdc281da4f3bc05bf43ec87706170..39d1133c614b21bf60b5c9619215994f4f634f35 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #include "trace.h"
 
index 93929c2880566e1592d60dd79ccf7a2d3214af1c..b8a3c92c9ee5f085c020f69779768a8654c6b714 100644 (file)
@@ -11,7 +11,7 @@
 #include "qemu/osdep.h"
 #include "hw/ipack/ipack.h"
 #include "qemu/bitops.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 /* #define DEBUG_IPOCTAL */
 
index f8c1e0d076ffd5b23b35681a2021c16f20392c3c..6b0633e518dce169992641770a65148e3228aaee 100644 (file)
@@ -21,7 +21,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "trace.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #include "hw/char/lm32_juart.h"
 
index 7f3597c4b0abc83a4063500b483bdc8d1d76f001..a7610c28ce1eac9491491372a66d41cf0badc84f 100644 (file)
@@ -26,7 +26,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "trace.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/error-report.h"
 
 enum {
index e69672f4e9f151cc8681f04335b3973612782631..b639b53c836b7bca1cc93e981c9fe1b9158672e2 100644 (file)
@@ -9,7 +9,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/m68k/mcf.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "exec/address-spaces.h"
 #include "qapi/error.h"
 
index ae8e2f35546af398940bce9a134c9c89dc37397f..5ef847c5ebf885b26bad5bb4b760c6a4bbd1284c 100644 (file)
@@ -25,7 +25,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "trace.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/error-report.h"
 
 enum {
index 31ebb1592c16e642a9764cc16e7e23a86ef14988..6fd1b9cf6b6a7a86471810b18243c0b2d96321b3 100644 (file)
@@ -18,7 +18,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/hw.h"
 #include "hw/arm/omap.h"
 #include "hw/char/serial.h"
index c71a4a0f4f5e01772f6a2bb8bb0d0c7978253d00..c926df0bee63de46f45f4cc760d87a4fa2b5a138 100644 (file)
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
 #include "sysemu/sysemu.h"
index 24ea9738b62b78f6465fc8db6e22d50cc72d3715..1757035bb38bd61838ca3510e3e17eb0aaf5f188 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/log.h"
 #include "trace.h"
 
index 07d6ebd112b974ad4711c23777fa0140d557531b..755d514188066a60bbf7dd39169105edd952fd26 100644 (file)
@@ -17,7 +17,7 @@
 #include "hw/qdev.h"
 #include "qemu/thread.h"
 #include "qemu/error-report.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #include "hw/s390x/sclp.h"
 #include "hw/s390x/event-facility.h"
index b78f240a73df9d6aa244cc1c91d644f7df62774a..0fd3cb4887bb2de12d161b7f80757408f85bad59 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "hw/s390x/sclp.h"
 #include "hw/s390x/event-facility.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 typedef struct ASCIIConsoleData {
     EventBufferHeader ebh;
index 03d890ca24287caee679a19d555ee411752988bc..aa336333be86b34f0b67f536c65c6490b71fbd0f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/char/serial.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
 #include "exec/address-spaces.h"
index 303eb0a678d3a5e4488c87efc034861b916ddb0e..80c7696d8d2daf31eb868223599dfef81f5520bd 100644 (file)
@@ -27,7 +27,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sh4/sh.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "exec/address-spaces.h"
 #include "qapi/error.h"
 
index e30c8da57c554e419d1628e2d2a7eb1242a07260..2317e454048c7bc2022e08a2eebecb17ef61d9a2 100644 (file)
@@ -4,7 +4,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/qdev.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
 
index b2dda01baa1754e45590e1c273d416e0d68dae16..c043104185b07378c761f44edf0c3d0929b3fddb 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/s390x/3270-ccw.h"
 
 /* Enough spaces for different window sizes. */
index 798d9b69fd7c05a8d70dbc8a33544263ad44e3eb..8418db6a07e9ff0770358aaba866f09d5a98b6eb 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/error-report.h"
 #include "trace.h"
 #include "hw/virtio/virtio-serial.h"
index c01f41090eb846c560e189117f0d0d33bcc02adf..1cdbe59f8a38ca9072f23615638db92f395155e2 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "qapi/error.h"
 #include "hw/hw.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/xen/xen_backend.h"
 #include "qapi/error.h"
 
index 37d313b4295d0b6ccde88bac2705a336e06d49bf..bcebdae3da1db5773374f568f41ad9ee2543bfd7 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #define DUART(x)
 
index 79c2014135e9d5cb669ab189107d597816ccab0c..4da0c6a24eadb70fb6d413d15392092d502981d5 100644 (file)
@@ -20,7 +20,7 @@
 #include "hw/block/block.h"
 #include "net/hub.h"
 #include "qapi/visitor.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/iothread.h"
 
 static void get_pointer(Object *obj, Visitor *v, Property *prop,
index fa3617db2df1a7f667b3181953c1aca24ab2822f..9f1a497322cb2b98da40d072c718b4de39136914 100644 (file)
@@ -9,7 +9,7 @@
 #include "hw/block/block.h"
 #include "net/hub.h"
 #include "qapi/visitor.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 void qdev_prop_set_after_realize(DeviceState *dev, const char *name,
                                   Error **errp)
index e8e3d250b6c2e3d2f9ccb122e2bd8364e979bb7b..35285383fd974f68a59cb9c8b3a0ba3f41a91aaf 100644 (file)
@@ -30,7 +30,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/sysemu.h"
 #include "hw/ipmi/ipmi.h"
 
index c707d24db492f1b8bd3d3e203890b91899db98b6..5ce9f0a062ee5dc2d4eccec06a2442dfa9751d4f 100644 (file)
@@ -30,7 +30,7 @@
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "trace.h"
 
 
index 53d1e0ce451e194f1dc27571086b6ebdb672d519..a4677f7da471e26a856b0c37eb2f18ba7f90f460 100644 (file)
@@ -35,7 +35,7 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/log.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/qtest.h"
index 475e36a4c7f74c26f8ab50d0f23b3758a48191c3..cd064dcf8cc383fef801b364ef661172b155d0d1 100644 (file)
@@ -29,7 +29,7 @@
 #include "qemu/error-report.h"
 #include "qemu/event_notifier.h"
 #include "qom/object_interfaces.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/hostmem.h"
 #include "sysemu/qtest.h"
 #include "qapi/visitor.h"
index a41b0d6ec531b570b9366921728bb26775563f8b..c2096b25ab6fae904e19059c9277ad012797bf5d 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
 #include "ccid.h"
index 76ceca1f5c0d9cbffaf917892516b358af23e490..4df995109bd978013fe1c2a9b3d3277f7c0ef37e 100644 (file)
@@ -15,7 +15,7 @@
 #include "qemu/error-report.h"
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 //#define DEBUG_Serial
 
index ad5ef783a680a3c54716b11defafc7380fa9d9f8..c862c1adeacf5a489969b89488bc89bfa597f891 100644 (file)
@@ -33,7 +33,7 @@
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/iov.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #include <usbredirparser.h>
 #include <usbredirfilter.h>
index dde094abb44ed036fe77dfbc6688c84c04eba108..44c9d8c9544ffb1a4c776b8232dd91dad030c081 100644 (file)
@@ -13,7 +13,7 @@
 #include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-backend.h"
 #include "hw/virtio/virtio-net.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/kvm.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
index a9055e9eba23042ba5624cb16839d851f400b10a..0bed5770c9fa1121cdae455822f0a7dfb61fcb28 100644 (file)
@@ -11,7 +11,7 @@
 #include "qemu/osdep.h"
 #include "hw/xen/xen_backend.h"
 #include "qmp-commands.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/accel.h"
 #include "migration/migration.h"
 
index 4636f8e934610a4db2553c1ca917122e02ac484e..d5ac080d4ae2da571e5f2eb44949cbdc8cc6bbca 100644 (file)
@@ -40,7 +40,7 @@
 #include "hw/sysbus.h"
 #include "hw/block/flash.h"
 #include "sysemu/block-backend.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/device_tree.h"
 #include "qemu/error-report.h"
 #include "bootparam.h"
diff --git a/include/chardev/char-fd.h b/include/chardev/char-fd.h
new file mode 100644 (file)
index 0000000..55ae5b4
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_FD_H
+#define CHAR_FD_H
+
+#include "io/channel.h"
+#include "chardev/char.h"
+
+typedef struct FDChardev {
+    Chardev parent;
+    Chardev *chr;
+    QIOChannel *ioc_in, *ioc_out;
+    int max_size;
+} FDChardev;
+
+#define TYPE_CHARDEV_FD "chardev-fd"
+
+#define FD_CHARDEV(obj) OBJECT_CHECK(FDChardev, (obj), TYPE_CHARDEV_FD)
+
+void qemu_chr_open_fd(Chardev *chr, int fd_in, int fd_out);
+int qmp_chardev_open_file_source(char *src, int flags, Error **errp);
+
+#endif /* CHAR_FD_H */
diff --git a/include/chardev/char-io.h b/include/chardev/char-io.h
new file mode 100644 (file)
index 0000000..9638da5
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_IO_H
+#define CHAR_IO_H
+
+#include "qemu-common.h"
+#include "io/channel.h"
+#include "chardev/char.h"
+
+/* Can only be used for read */
+GSource *io_add_watch_poll(Chardev *chr,
+                        QIOChannel *ioc,
+                        IOCanReadHandler *fd_can_read,
+                        QIOChannelFunc fd_read,
+                        gpointer user_data,
+                        GMainContext *context);
+
+void remove_fd_in_watch(Chardev *chr);
+
+int io_channel_send(QIOChannel *ioc, const void *buf, size_t len);
+
+int io_channel_send_full(QIOChannel *ioc, const void *buf, size_t len,
+                         int *fds, size_t nfds);
+
+#endif /* CHAR_IO_H */
diff --git a/include/chardev/char-mux.h b/include/chardev/char-mux.h
new file mode 100644 (file)
index 0000000..45cdfc7
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_MUX_H
+#define CHAR_MUX_H
+
+#include "chardev/char.h"
+
+extern bool muxes_realized;
+
+#define MAX_MUX 4
+#define MUX_BUFFER_SIZE 32 /* Must be a power of 2.  */
+#define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1)
+typedef struct MuxChardev {
+    Chardev parent;
+    CharBackend *backends[MAX_MUX];
+    CharBackend chr;
+    int focus;
+    int mux_cnt;
+    int term_got_escape;
+    int max_size;
+    /* Intermediate input buffer catches escape sequences even if the
+       currently active device is not accepting any input - but only until it
+       is full as well. */
+    unsigned char buffer[MAX_MUX][MUX_BUFFER_SIZE];
+    int prod[MAX_MUX];
+    int cons[MAX_MUX];
+    int timestamps;
+
+    /* Protected by the Chardev chr_write_lock.  */
+    int linestart;
+    int64_t timestamps_start;
+} MuxChardev;
+
+#define MUX_CHARDEV(obj) OBJECT_CHECK(MuxChardev, (obj), TYPE_CHARDEV_MUX)
+#define CHARDEV_IS_MUX(chr)                             \
+    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
+
+void mux_chr_set_handlers(Chardev *chr, GMainContext *context);
+void mux_set_focus(Chardev *chr, int focus);
+void mux_chr_send_all_event(Chardev *chr, int event);
+
+#endif /* CHAR_MUX_H */
diff --git a/include/chardev/char-parallel.h b/include/chardev/char-parallel.h
new file mode 100644 (file)
index 0000000..26742f9
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_PARALLEL_H
+#define CHAR_PARALLEL_H
+
+#if defined(__linux__) || defined(__FreeBSD__) || \
+    defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+#define HAVE_CHARDEV_PARPORT 1
+#endif
+
+#endif /* CHAR_PARALLEL_H */
diff --git a/include/chardev/char-serial.h b/include/chardev/char-serial.h
new file mode 100644 (file)
index 0000000..64a27f6
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_SERIAL_H
+#define CHAR_SERIAL_H
+
+#ifdef _WIN32
+#define HAVE_CHARDEV_SERIAL 1
+#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
+    || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
+    || defined(__GLIBC__)
+#define HAVE_CHARDEV_SERIAL 1
+#endif
+
+#endif
diff --git a/include/chardev/char-win-stdio.h b/include/chardev/char-win-stdio.h
new file mode 100644 (file)
index 0000000..d7314f7
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_WIN_STDIO_H
+#define CHAR_WIN_STDIO_H
+
+#define TYPE_CHARDEV_WIN_STDIO "chardev-win-stdio"
+
+#endif /* CHAR_WIN_STDIO_H */
diff --git a/include/chardev/char-win.h b/include/chardev/char-win.h
new file mode 100644 (file)
index 0000000..fa59e9e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef CHAR_WIN_H
+#define CHAR_WIN_H
+
+#include "chardev/char.h"
+
+typedef struct {
+    Chardev parent;
+
+    bool keep_open; /* console do not close file */
+    HANDLE file, hrecv, hsend;
+    OVERLAPPED orecv;
+    BOOL fpipe;
+
+    /* Protected by the Chardev chr_write_lock.  */
+    OVERLAPPED osend;
+} WinChardev;
+
+#define NSENDBUF 2048
+#define NRECVBUF 2048
+
+#define TYPE_CHARDEV_WIN "chardev-win"
+#define WIN_CHARDEV(obj) OBJECT_CHECK(WinChardev, (obj), TYPE_CHARDEV_WIN)
+
+void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open);
+int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp);
+int win_chr_pipe_poll(void *opaque);
+
+#endif /* CHAR_WIN_H */
diff --git a/include/chardev/char.h b/include/chardev/char.h
new file mode 100644 (file)
index 0000000..fffc0f4
--- /dev/null
@@ -0,0 +1,499 @@
+#ifndef QEMU_CHAR_H
+#define QEMU_CHAR_H
+
+#include "qemu-common.h"
+#include "qemu/option.h"
+#include "qemu/main-loop.h"
+#include "qemu/bitmap.h"
+#include "qom/object.h"
+
+#define IAC_EOR 239
+#define IAC_SE 240
+#define IAC_NOP 241
+#define IAC_BREAK 243
+#define IAC_IP 244
+#define IAC_SB 250
+#define IAC 255
+
+/* character device */
+
+typedef enum {
+    CHR_EVENT_BREAK, /* serial break char */
+    CHR_EVENT_OPENED, /* new connection established */
+    CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */
+    CHR_EVENT_MUX_OUT, /* mux-focus will move on */
+    CHR_EVENT_CLOSED /* connection closed */
+} QEMUChrEvent;
+
+#define CHR_READ_BUF_LEN 4096
+
+#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
+
+struct ParallelIOArg {
+    void *buffer;
+    int count;
+};
+
+#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);
+
+typedef enum {
+    /* Whether the chardev peer is able to close and
+     * reopen the data channel, thus requiring support
+     * for qemu_chr_wait_connected() to wait for a
+     * valid connection */
+    QEMU_CHAR_FEATURE_RECONNECTABLE,
+    /* Whether it is possible to send/recv file descriptors
+     * over the data channel */
+    QEMU_CHAR_FEATURE_FD_PASS,
+    /* Whether replay or record mode is enabled */
+    QEMU_CHAR_FEATURE_REPLAY,
+
+    QEMU_CHAR_FEATURE_LAST,
+} ChardevFeature;
+
+/* This is the backend as seen by frontend, the actual backend is
+ * Chardev */
+typedef struct CharBackend {
+    Chardev *chr;
+    IOEventHandler *chr_event;
+    IOCanReadHandler *chr_can_read;
+    IOReadHandler *chr_read;
+    void *opaque;
+    int tag;
+    int fe_open;
+} CharBackend;
+
+struct Chardev {
+    Object parent_obj;
+
+    QemuMutex chr_write_lock;
+    CharBackend *be;
+    char *label;
+    char *filename;
+    int logfd;
+    int be_open;
+    GSource *gsource;
+    DECLARE_BITMAP(features, QEMU_CHAR_FEATURE_LAST);
+};
+
+/**
+ * @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
+ *
+ * Returns: a new character backend
+ */
+Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
+                                Error **errp);
+
+/**
+ * @qemu_chr_parse_common:
+ *
+ * Parse the common options available to all character backends.
+ *
+ * @opts the options that still need parsing
+ * @backend a new backend
+ */
+void qemu_chr_parse_common(QemuOpts *opts, ChardevCommon *backend);
+
+/**
+ * @qemu_chr_new:
+ *
+ * Create a new character backend from a URI.
+ *
+ * @label the name of the backend
+ * @filename the URI
+ *
+ * Returns: a new character backend
+ */
+Chardev *qemu_chr_new(const char *label, const char *filename);
+
+
+/**
+ * @qemu_chr_fe_disconnect:
+ *
+ * Close a fd accpeted by character backend.
+ * Without associated Chardev, do nothing.
+ */
+void qemu_chr_fe_disconnect(CharBackend *be);
+
+/**
+ * @qemu_chr_cleanup:
+ *
+ * Delete all chardevs (when leaving qemu)
+ */
+void qemu_chr_cleanup(void);
+
+/**
+ * @qemu_chr_fe_wait_connected:
+ *
+ * Wait for characted backend to be connected, return < 0 on error or
+ * if no assicated Chardev.
+ */
+int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp);
+
+/**
+ * @qemu_chr_new_noreplay:
+ *
+ * Create a new character backend from a URI.
+ * Character device communications are not written
+ * into the replay log.
+ *
+ * @label the name of the backend
+ * @filename the URI
+ *
+ * Returns: a new character backend
+ */
+Chardev *qemu_chr_new_noreplay(const char *label, const char *filename);
+
+/**
+ * @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.
+ * Without associated Chardev, do nothing.
+ *
+ * @echo true to enable echo, false to disable echo
+ */
+void qemu_chr_fe_set_echo(CharBackend *be, bool echo);
+
+/**
+ * @qemu_chr_fe_set_open:
+ *
+ * Set character frontend open status.  This is an indication that the
+ * front end is ready (or not) to begin doing I/O.
+ * Without associated Chardev, do nothing.
+ */
+void qemu_chr_fe_set_open(CharBackend *be, int fe_open);
+
+/**
+ * @qemu_chr_fe_printf:
+ *
+ * Write to a character backend using a printf style interface.  This
+ * function is thread-safe. It does nothing without associated
+ * Chardev.
+ *
+ * @fmt see #printf
+ */
+void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...)
+    GCC_FMT_ATTR(2, 3);
+
+/**
+ * @qemu_chr_fe_add_watch:
+ *
+ * If the backend is connected, create and add a #GSource that fires
+ * when the given condition (typically G_IO_OUT|G_IO_HUP or G_IO_HUP)
+ * is active; return the #GSource's tag.  If it is disconnected,
+ * or without associated Chardev, return 0.
+ *
+ * @cond the condition to poll for
+ * @func the function to call when the condition happens
+ * @user_data the opaque pointer to pass to @func
+ *
+ * Returns: the source tag
+ */
+guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond,
+                            GIOFunc func, void *user_data);
+
+/**
+ * @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.  This function
+ * is thread-safe.
+ *
+ * @buf the data
+ * @len the number of bytes to send
+ *
+ * Returns: the number of bytes consumed (0 if no assicated Chardev)
+ */
+int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len);
+
+/**
+ * @qemu_chr_fe_write_all:
+ *
+ * Write data to a character backend from the front end.  This function will
+ * send data from the front end to the back end.  Unlike @qemu_chr_fe_write,
+ * this function will block if the back end cannot consume all of the data
+ * attempted to be written.  This function is thread-safe.
+ *
+ * @buf the data
+ * @len the number of bytes to send
+ *
+ * Returns: the number of bytes consumed (0 if no assicated Chardev)
+ */
+int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len);
+
+/**
+ * @qemu_chr_fe_read_all:
+ *
+ * Read data to a buffer from the back end.
+ *
+ * @buf the data buffer
+ * @len the number of bytes to read
+ *
+ * Returns: the number of bytes read (0 if no assicated Chardev)
+ */
+int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len);
+
+/**
+ * @qemu_chr_fe_ioctl:
+ *
+ * Issue a device specific ioctl to a backend.  This function is thread-safe.
+ *
+ * @cmd see CHR_IOCTL_*
+ * @arg the data associated with @cmd
+ *
+ * Returns: if @cmd is not supported by the backend or there is no
+ *          associated Chardev, -ENOTSUP, otherwise the return
+ *          value depends on the semantics of @cmd
+ */
+int qemu_chr_fe_ioctl(CharBackend *be, 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(CharBackend *be);
+
+/**
+ * @qemu_chr_fe_get_msgfds:
+ *
+ * For backends capable of fd passing, return the number of file received
+ * descriptors and fills the fds array up to num elements
+ *
+ * Returns: -1 if fd passing isn't supported or there are no pending file
+ *          descriptors.  If file descriptors are returned, subsequent calls to
+ *          this function will return -1 until a client sends a new set of file
+ *          descriptors.
+ */
+int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, int num);
+
+/**
+ * @qemu_chr_fe_set_msgfds:
+ *
+ * For backends capable of fd passing, set an array of fds to be passed with
+ * the next send operation.
+ * A subsequent call to this function before calling a write function will
+ * result in overwriting the fd array with the new value without being send.
+ * Upon writing the message the fd array is freed.
+ *
+ * Returns: -1 if fd passing isn't supported or no associated Chardev.
+ */
+int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, int num);
+
+/**
+ * @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(Chardev *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(Chardev *s, uint8_t *buf, int len);
+
+/**
+ * @qemu_chr_be_write_impl:
+ *
+ * Implementation of back end writing. Used by replay module.
+ *
+ * @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_impl(Chardev *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(Chardev *s, int event);
+
+/**
+ * @qemu_chr_fe_init:
+ *
+ * Initializes a front end for the given CharBackend and
+ * Chardev. Call qemu_chr_fe_deinit() to remove the association and
+ * release the driver.
+ *
+ * Returns: false on error.
+ */
+bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp);
+
+/**
+ * @qemu_chr_fe_get_driver:
+ *
+ * Returns the driver associated with a CharBackend or NULL if no
+ * associated Chardev.
+ */
+Chardev *qemu_chr_fe_get_driver(CharBackend *be);
+
+/**
+ * @qemu_chr_fe_deinit:
+ *
+ * Dissociate the CharBackend from the Chardev.
+ *
+ * Safe to call without associated Chardev.
+ */
+void qemu_chr_fe_deinit(CharBackend *b);
+
+/**
+ * @qemu_chr_fe_set_handlers:
+ * @b: a CharBackend
+ * @fd_can_read: callback to get the amount of data the frontend may
+ *               receive
+ * @fd_read: callback to receive data from char
+ * @fd_event: event callback
+ * @opaque: an opaque pointer for the callbacks
+ * @context: a main loop context or NULL for the default
+ * @set_open: whether to call qemu_chr_fe_set_open() implicitely when
+ * any of the handler is non-NULL
+ *
+ * Set the front end char handlers. The front end takes the focus if
+ * any of the handler is non-NULL.
+ *
+ * Without associated Chardev, nothing is changed.
+ */
+void qemu_chr_fe_set_handlers(CharBackend *b,
+                              IOCanReadHandler *fd_can_read,
+                              IOReadHandler *fd_read,
+                              IOEventHandler *fd_event,
+                              void *opaque,
+                              GMainContext *context,
+                              bool set_open);
+
+/**
+ * @qemu_chr_fe_take_focus:
+ *
+ * Take the focus (if the front end is muxed).
+ *
+ * Without associated Chardev, nothing is changed.
+ */
+void qemu_chr_fe_take_focus(CharBackend *b);
+
+void qemu_chr_fe_accept_input(CharBackend *be);
+int qemu_chr_add_client(Chardev *s, int fd);
+Chardev *qemu_chr_find(const char *name);
+
+bool qemu_chr_has_feature(Chardev *chr,
+                          ChardevFeature feature);
+void qemu_chr_set_feature(Chardev *chr,
+                          ChardevFeature feature);
+QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
+int qemu_chr_write_all(Chardev *s, const uint8_t *buf, int len);
+int qemu_chr_wait_connected(Chardev *chr, Error **errp);
+
+#define TYPE_CHARDEV "chardev"
+#define CHARDEV(obj) OBJECT_CHECK(Chardev, (obj), TYPE_CHARDEV)
+#define CHARDEV_CLASS(klass) \
+    OBJECT_CLASS_CHECK(ChardevClass, (klass), TYPE_CHARDEV)
+#define CHARDEV_GET_CLASS(obj) \
+    OBJECT_GET_CLASS(ChardevClass, (obj), TYPE_CHARDEV)
+
+#define TYPE_CHARDEV_NULL "chardev-null"
+#define TYPE_CHARDEV_MUX "chardev-mux"
+#define TYPE_CHARDEV_RINGBUF "chardev-ringbuf"
+#define TYPE_CHARDEV_PTY "chardev-pty"
+#define TYPE_CHARDEV_CONSOLE "chardev-console"
+#define TYPE_CHARDEV_STDIO "chardev-stdio"
+#define TYPE_CHARDEV_PIPE "chardev-pipe"
+#define TYPE_CHARDEV_MEMORY "chardev-memory"
+#define TYPE_CHARDEV_PARALLEL "chardev-parallel"
+#define TYPE_CHARDEV_FILE "chardev-file"
+#define TYPE_CHARDEV_SERIAL "chardev-serial"
+#define TYPE_CHARDEV_SOCKET "chardev-socket"
+#define TYPE_CHARDEV_UDP "chardev-udp"
+
+#define CHARDEV_IS_RINGBUF(chr) \
+    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_RINGBUF)
+#define CHARDEV_IS_PTY(chr) \
+    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_PTY)
+
+typedef struct ChardevClass {
+    ObjectClass parent_class;
+
+    bool internal; /* TODO: eventually use TYPE_USER_CREATABLE */
+    void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp);
+
+    void (*open)(Chardev *chr, ChardevBackend *backend,
+                 bool *be_opened, Error **errp);
+
+    int (*chr_write)(Chardev *s, const uint8_t *buf, int len);
+    int (*chr_sync_read)(Chardev *s, const uint8_t *buf, int len);
+    GSource *(*chr_add_watch)(Chardev *s, GIOCondition cond);
+    void (*chr_update_read_handler)(Chardev *s, GMainContext *context);
+    int (*chr_ioctl)(Chardev *s, int cmd, void *arg);
+    int (*get_msgfds)(Chardev *s, int* fds, int num);
+    int (*set_msgfds)(Chardev *s, int *fds, int num);
+    int (*chr_add_client)(Chardev *chr, int fd);
+    int (*chr_wait_connected)(Chardev *chr, Error **errp);
+    void (*chr_disconnect)(Chardev *chr);
+    void (*chr_accept_input)(Chardev *chr);
+    void (*chr_set_echo)(Chardev *chr, bool echo);
+    void (*chr_set_fe_open)(Chardev *chr, int fe_open);
+} ChardevClass;
+
+Chardev *qemu_chardev_new(const char *id, const char *typename,
+                          ChardevBackend *backend, Error **errp);
+
+extern int term_escape_char;
+
+/* console.c */
+void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp);
+
+#endif
index 6865f154bc197d23d5ae7619513b136fe4461a5d..2a051c5646ff7c6a95b0cde6714bc9e7898c48a6 100644 (file)
@@ -9,7 +9,7 @@
 #define BCM2835_AUX_H
 
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #define TYPE_BCM2835_AUX "bcm2835-aux"
 #define BCM2835_AUX(obj) OBJECT_CHECK(BCM2835AuxState, (obj), TYPE_BCM2835_AUX)
index c836db4b7405830d880fdd256697be3872af9744..eed7d8d358408bcac6308324928b40b4a3561043 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef CADENCE_UART_H
 
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/timer.h"
 
 #define CADENCE_UART_RX_FIFO_SIZE           16
index 340c8e1111e9c1d593e689ed5632a2c3ac4ad453..370b48a6c5a1916774f94307e67a6d6617f29212 100644 (file)
@@ -19,7 +19,7 @@
 #define HW_CHAR_DIGIC_UART_H
 
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #define TYPE_DIGIC_UART "digic-uart"
 #define DIGIC_UART(obj) \
index 4cc3fbc395194bb278b9da3a7ece781fd5fa5cee..05500f5346c095554a483d6c2e70feb5d9432ef4 100644 (file)
@@ -19,7 +19,7 @@
 #define IMX_SERIAL_H
 
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #define TYPE_IMX_SERIAL "imx.serial"
 #define IMX_SERIAL(obj) OBJECT_CHECK(IMXSerialState, (obj), TYPE_IMX_SERIAL)
index daebb076c2012edb1247cadf13d4d0d668ac2e1b..01dcd2a8d2f4f51a28b7e98aa72e9305dab57d05 100644 (file)
 
 #include "hw/hw.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "exec/memory.h"
 #include "qemu/fifo8.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 #define UART_FIFO_LENGTH    16      /* 16550A Fifo Length */
 
index 3267523270c966584b7325cdd8776417f1cc9ebe..4259dbeb1ec1711821320383d201fe1df0c355a9 100644 (file)
@@ -26,7 +26,7 @@
 #define HW_STM32F2XX_USART_H
 
 #include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "hw/hw.h"
 
 #define USART_SR   0x00
diff --git a/include/sysemu/char.h b/include/sysemu/char.h
deleted file mode 100644 (file)
index fffc0f4..0000000
+++ /dev/null
@@ -1,499 +0,0 @@
-#ifndef QEMU_CHAR_H
-#define QEMU_CHAR_H
-
-#include "qemu-common.h"
-#include "qemu/option.h"
-#include "qemu/main-loop.h"
-#include "qemu/bitmap.h"
-#include "qom/object.h"
-
-#define IAC_EOR 239
-#define IAC_SE 240
-#define IAC_NOP 241
-#define IAC_BREAK 243
-#define IAC_IP 244
-#define IAC_SB 250
-#define IAC 255
-
-/* character device */
-
-typedef enum {
-    CHR_EVENT_BREAK, /* serial break char */
-    CHR_EVENT_OPENED, /* new connection established */
-    CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */
-    CHR_EVENT_MUX_OUT, /* mux-focus will move on */
-    CHR_EVENT_CLOSED /* connection closed */
-} QEMUChrEvent;
-
-#define CHR_READ_BUF_LEN 4096
-
-#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
-
-struct ParallelIOArg {
-    void *buffer;
-    int count;
-};
-
-#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);
-
-typedef enum {
-    /* Whether the chardev peer is able to close and
-     * reopen the data channel, thus requiring support
-     * for qemu_chr_wait_connected() to wait for a
-     * valid connection */
-    QEMU_CHAR_FEATURE_RECONNECTABLE,
-    /* Whether it is possible to send/recv file descriptors
-     * over the data channel */
-    QEMU_CHAR_FEATURE_FD_PASS,
-    /* Whether replay or record mode is enabled */
-    QEMU_CHAR_FEATURE_REPLAY,
-
-    QEMU_CHAR_FEATURE_LAST,
-} ChardevFeature;
-
-/* This is the backend as seen by frontend, the actual backend is
- * Chardev */
-typedef struct CharBackend {
-    Chardev *chr;
-    IOEventHandler *chr_event;
-    IOCanReadHandler *chr_can_read;
-    IOReadHandler *chr_read;
-    void *opaque;
-    int tag;
-    int fe_open;
-} CharBackend;
-
-struct Chardev {
-    Object parent_obj;
-
-    QemuMutex chr_write_lock;
-    CharBackend *be;
-    char *label;
-    char *filename;
-    int logfd;
-    int be_open;
-    GSource *gsource;
-    DECLARE_BITMAP(features, QEMU_CHAR_FEATURE_LAST);
-};
-
-/**
- * @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
- *
- * Returns: a new character backend
- */
-Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
-                                Error **errp);
-
-/**
- * @qemu_chr_parse_common:
- *
- * Parse the common options available to all character backends.
- *
- * @opts the options that still need parsing
- * @backend a new backend
- */
-void qemu_chr_parse_common(QemuOpts *opts, ChardevCommon *backend);
-
-/**
- * @qemu_chr_new:
- *
- * Create a new character backend from a URI.
- *
- * @label the name of the backend
- * @filename the URI
- *
- * Returns: a new character backend
- */
-Chardev *qemu_chr_new(const char *label, const char *filename);
-
-
-/**
- * @qemu_chr_fe_disconnect:
- *
- * Close a fd accpeted by character backend.
- * Without associated Chardev, do nothing.
- */
-void qemu_chr_fe_disconnect(CharBackend *be);
-
-/**
- * @qemu_chr_cleanup:
- *
- * Delete all chardevs (when leaving qemu)
- */
-void qemu_chr_cleanup(void);
-
-/**
- * @qemu_chr_fe_wait_connected:
- *
- * Wait for characted backend to be connected, return < 0 on error or
- * if no assicated Chardev.
- */
-int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp);
-
-/**
- * @qemu_chr_new_noreplay:
- *
- * Create a new character backend from a URI.
- * Character device communications are not written
- * into the replay log.
- *
- * @label the name of the backend
- * @filename the URI
- *
- * Returns: a new character backend
- */
-Chardev *qemu_chr_new_noreplay(const char *label, const char *filename);
-
-/**
- * @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.
- * Without associated Chardev, do nothing.
- *
- * @echo true to enable echo, false to disable echo
- */
-void qemu_chr_fe_set_echo(CharBackend *be, bool echo);
-
-/**
- * @qemu_chr_fe_set_open:
- *
- * Set character frontend open status.  This is an indication that the
- * front end is ready (or not) to begin doing I/O.
- * Without associated Chardev, do nothing.
- */
-void qemu_chr_fe_set_open(CharBackend *be, int fe_open);
-
-/**
- * @qemu_chr_fe_printf:
- *
- * Write to a character backend using a printf style interface.  This
- * function is thread-safe. It does nothing without associated
- * Chardev.
- *
- * @fmt see #printf
- */
-void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
-
-/**
- * @qemu_chr_fe_add_watch:
- *
- * If the backend is connected, create and add a #GSource that fires
- * when the given condition (typically G_IO_OUT|G_IO_HUP or G_IO_HUP)
- * is active; return the #GSource's tag.  If it is disconnected,
- * or without associated Chardev, return 0.
- *
- * @cond the condition to poll for
- * @func the function to call when the condition happens
- * @user_data the opaque pointer to pass to @func
- *
- * Returns: the source tag
- */
-guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond,
-                            GIOFunc func, void *user_data);
-
-/**
- * @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.  This function
- * is thread-safe.
- *
- * @buf the data
- * @len the number of bytes to send
- *
- * Returns: the number of bytes consumed (0 if no assicated Chardev)
- */
-int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len);
-
-/**
- * @qemu_chr_fe_write_all:
- *
- * Write data to a character backend from the front end.  This function will
- * send data from the front end to the back end.  Unlike @qemu_chr_fe_write,
- * this function will block if the back end cannot consume all of the data
- * attempted to be written.  This function is thread-safe.
- *
- * @buf the data
- * @len the number of bytes to send
- *
- * Returns: the number of bytes consumed (0 if no assicated Chardev)
- */
-int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len);
-
-/**
- * @qemu_chr_fe_read_all:
- *
- * Read data to a buffer from the back end.
- *
- * @buf the data buffer
- * @len the number of bytes to read
- *
- * Returns: the number of bytes read (0 if no assicated Chardev)
- */
-int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len);
-
-/**
- * @qemu_chr_fe_ioctl:
- *
- * Issue a device specific ioctl to a backend.  This function is thread-safe.
- *
- * @cmd see CHR_IOCTL_*
- * @arg the data associated with @cmd
- *
- * Returns: if @cmd is not supported by the backend or there is no
- *          associated Chardev, -ENOTSUP, otherwise the return
- *          value depends on the semantics of @cmd
- */
-int qemu_chr_fe_ioctl(CharBackend *be, 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(CharBackend *be);
-
-/**
- * @qemu_chr_fe_get_msgfds:
- *
- * For backends capable of fd passing, return the number of file received
- * descriptors and fills the fds array up to num elements
- *
- * Returns: -1 if fd passing isn't supported or there are no pending file
- *          descriptors.  If file descriptors are returned, subsequent calls to
- *          this function will return -1 until a client sends a new set of file
- *          descriptors.
- */
-int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, int num);
-
-/**
- * @qemu_chr_fe_set_msgfds:
- *
- * For backends capable of fd passing, set an array of fds to be passed with
- * the next send operation.
- * A subsequent call to this function before calling a write function will
- * result in overwriting the fd array with the new value without being send.
- * Upon writing the message the fd array is freed.
- *
- * Returns: -1 if fd passing isn't supported or no associated Chardev.
- */
-int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, int num);
-
-/**
- * @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(Chardev *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(Chardev *s, uint8_t *buf, int len);
-
-/**
- * @qemu_chr_be_write_impl:
- *
- * Implementation of back end writing. Used by replay module.
- *
- * @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_impl(Chardev *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(Chardev *s, int event);
-
-/**
- * @qemu_chr_fe_init:
- *
- * Initializes a front end for the given CharBackend and
- * Chardev. Call qemu_chr_fe_deinit() to remove the association and
- * release the driver.
- *
- * Returns: false on error.
- */
-bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp);
-
-/**
- * @qemu_chr_fe_get_driver:
- *
- * Returns the driver associated with a CharBackend or NULL if no
- * associated Chardev.
- */
-Chardev *qemu_chr_fe_get_driver(CharBackend *be);
-
-/**
- * @qemu_chr_fe_deinit:
- *
- * Dissociate the CharBackend from the Chardev.
- *
- * Safe to call without associated Chardev.
- */
-void qemu_chr_fe_deinit(CharBackend *b);
-
-/**
- * @qemu_chr_fe_set_handlers:
- * @b: a CharBackend
- * @fd_can_read: callback to get the amount of data the frontend may
- *               receive
- * @fd_read: callback to receive data from char
- * @fd_event: event callback
- * @opaque: an opaque pointer for the callbacks
- * @context: a main loop context or NULL for the default
- * @set_open: whether to call qemu_chr_fe_set_open() implicitely when
- * any of the handler is non-NULL
- *
- * Set the front end char handlers. The front end takes the focus if
- * any of the handler is non-NULL.
- *
- * Without associated Chardev, nothing is changed.
- */
-void qemu_chr_fe_set_handlers(CharBackend *b,
-                              IOCanReadHandler *fd_can_read,
-                              IOReadHandler *fd_read,
-                              IOEventHandler *fd_event,
-                              void *opaque,
-                              GMainContext *context,
-                              bool set_open);
-
-/**
- * @qemu_chr_fe_take_focus:
- *
- * Take the focus (if the front end is muxed).
- *
- * Without associated Chardev, nothing is changed.
- */
-void qemu_chr_fe_take_focus(CharBackend *b);
-
-void qemu_chr_fe_accept_input(CharBackend *be);
-int qemu_chr_add_client(Chardev *s, int fd);
-Chardev *qemu_chr_find(const char *name);
-
-bool qemu_chr_has_feature(Chardev *chr,
-                          ChardevFeature feature);
-void qemu_chr_set_feature(Chardev *chr,
-                          ChardevFeature feature);
-QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
-int qemu_chr_write_all(Chardev *s, const uint8_t *buf, int len);
-int qemu_chr_wait_connected(Chardev *chr, Error **errp);
-
-#define TYPE_CHARDEV "chardev"
-#define CHARDEV(obj) OBJECT_CHECK(Chardev, (obj), TYPE_CHARDEV)
-#define CHARDEV_CLASS(klass) \
-    OBJECT_CLASS_CHECK(ChardevClass, (klass), TYPE_CHARDEV)
-#define CHARDEV_GET_CLASS(obj) \
-    OBJECT_GET_CLASS(ChardevClass, (obj), TYPE_CHARDEV)
-
-#define TYPE_CHARDEV_NULL "chardev-null"
-#define TYPE_CHARDEV_MUX "chardev-mux"
-#define TYPE_CHARDEV_RINGBUF "chardev-ringbuf"
-#define TYPE_CHARDEV_PTY "chardev-pty"
-#define TYPE_CHARDEV_CONSOLE "chardev-console"
-#define TYPE_CHARDEV_STDIO "chardev-stdio"
-#define TYPE_CHARDEV_PIPE "chardev-pipe"
-#define TYPE_CHARDEV_MEMORY "chardev-memory"
-#define TYPE_CHARDEV_PARALLEL "chardev-parallel"
-#define TYPE_CHARDEV_FILE "chardev-file"
-#define TYPE_CHARDEV_SERIAL "chardev-serial"
-#define TYPE_CHARDEV_SOCKET "chardev-socket"
-#define TYPE_CHARDEV_UDP "chardev-udp"
-
-#define CHARDEV_IS_RINGBUF(chr) \
-    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_RINGBUF)
-#define CHARDEV_IS_PTY(chr) \
-    object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_PTY)
-
-typedef struct ChardevClass {
-    ObjectClass parent_class;
-
-    bool internal; /* TODO: eventually use TYPE_USER_CREATABLE */
-    void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp);
-
-    void (*open)(Chardev *chr, ChardevBackend *backend,
-                 bool *be_opened, Error **errp);
-
-    int (*chr_write)(Chardev *s, const uint8_t *buf, int len);
-    int (*chr_sync_read)(Chardev *s, const uint8_t *buf, int len);
-    GSource *(*chr_add_watch)(Chardev *s, GIOCondition cond);
-    void (*chr_update_read_handler)(Chardev *s, GMainContext *context);
-    int (*chr_ioctl)(Chardev *s, int cmd, void *arg);
-    int (*get_msgfds)(Chardev *s, int* fds, int num);
-    int (*set_msgfds)(Chardev *s, int *fds, int num);
-    int (*chr_add_client)(Chardev *chr, int fd);
-    int (*chr_wait_connected)(Chardev *chr, Error **errp);
-    void (*chr_disconnect)(Chardev *chr);
-    void (*chr_accept_input)(Chardev *chr);
-    void (*chr_set_echo)(Chardev *chr, bool echo);
-    void (*chr_set_fe_open)(Chardev *chr, int fe_open);
-} ChardevClass;
-
-Chardev *qemu_chardev_new(const char *id, const char *typename,
-                          ChardevBackend *backend, Error **errp);
-
-extern int term_escape_char;
-
-/* console.c */
-void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp);
-
-#endif
index baa73c98b7d6d4cd087e17128284af4ab234f474..29b71ff2bc3c5ad9668c3489a34e5492c194794b 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -35,7 +35,7 @@
 #include "exec/gdbstub.h"
 #include "net/net.h"
 #include "net/slirp.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "ui/qemu-spice.h"
 #include "sysemu/numa.h"
 #include "monitor/monitor.h"
index 2639c7f0a2a1122bf0fc8965702d45313198f058..619335d5e8f41b580bd7e4e3c64962ef9eb5c50c 100644 (file)
@@ -25,7 +25,7 @@
 #include "qom/object.h"
 #include "qemu/typedefs.h"
 #include "net/queue.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/sockets.h"
 #include "qapi-visit.h"
 #include "net/colo.h"
index 8b1b06977da26255ad9f7a0bec0cc59eb21aa3f8..7adc2c10d2baf89e206bc552ebdd28d2e14128ba 100644 (file)
@@ -20,7 +20,7 @@
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"
 #include "trace.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
 
index c705a60b6256ac7473a0f04ab07db67385f88fa3..af3e8b22ac27d233b5c80ca3f4e0d67af1dfbbb5 100644 (file)
@@ -37,7 +37,7 @@
 #include "qemu/sockets.h"
 #include "slirp/libslirp.h"
 #include "slirp/ip6.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/sysemu.h"
 #include "qemu/cutils.h"
 #include "qapi/error.h"
index 00a0c1cbc57698ab5b90652530f3d6e44323512f..77d2ce22a669fd2292fd51a7f3d25ff36a763c01 100644 (file)
@@ -12,7 +12,7 @@
 #include "clients.h"
 #include "net/vhost_net.h"
 #include "net/vhost-user.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qmp-commands.h"
diff --git a/qmp.c b/qmp.c
index 84638e2b2b786b79fdafbc09574f207cf301ecd0..7ee9bcfdcf123a55438c106e0202982381045f9e 100644 (file)
--- a/qmp.c
+++ b/qmp.c
@@ -21,7 +21,7 @@
 #include "qemu/config-file.h"
 #include "qemu/uuid.h"
 #include "qmp-commands.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "ui/qemu-spice.h"
 #include "ui/vnc.h"
 #include "sysemu/kvm.h"
diff --git a/qtest.c b/qtest.c
index 5aa6636ca892a2fde3f8661d1718f0f5608a73d7..dbf70a7018d085e19ad78bc2dbb4e35e6957801c 100644 (file)
--- a/qtest.c
+++ b/qtest.c
@@ -17,7 +17,7 @@
 #include "cpu.h"
 #include "sysemu/qtest.h"
 #include "hw/qdev.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "exec/ioport.h"
 #include "exec/memory.h"
 #include "hw/irq.h"
index aa65955942b5193bb62f1b66624e47485069aeeb..cbf7c04a9f6b3c48cc1a15af355dfa9c343bcd72 100755 (executable)
@@ -14,7 +14,7 @@
 #include "sysemu/replay.h"
 #include "replay-internal.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 
 /* Char drivers that generate qemu_chr_be_write events
    that should be saved into the log. */
index 2f2ec2c1b3648ae3d48e4dacb2f225a2a49e2960..3b92cb54cec20b4470b4a83556eb1b16413c2eb3 100644 (file)
@@ -25,7 +25,7 @@
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "slirp.h"
 #include "hw/hw.h"
 #include "qemu/cutils.h"
index 4d1c76e8a418fb6c45824567ec610e9fae105eec..1c6c2e3969abd3692f0c5173b19f3f0a034411dc 100644 (file)
@@ -1,7 +1,7 @@
 #include "qemu/osdep.h"
 #include "trace-root.h"
 #include "ui/qemu-spice.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/error-report.h"
 #include <spice.h>
 #include <spice/protocol.h>
index e86f87656af31b5d084c6e13fbcb82bb868aa35c..8142f2ab90723bc8e2beab0310dcbf412bd7b56c 100644 (file)
@@ -16,7 +16,7 @@
 #include "qemu/option.h"
 #include "qemu/range.h"
 #include "qemu/sockets.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/sysemu.h"
 #include "hw/nvram/chrp_nvram.h"
 
index 124d0c54390bc8936a899e3f2d7b9dd14670b17c..9340c55058ab6cd63f2adbc7c5a5a1022a908eca 100644 (file)
@@ -4,7 +4,7 @@
 #include "qemu-common.h"
 #include "qemu/config-file.h"
 #include "qemu/sockets.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
 #include "qom/qom-qobject.h"
index 9095af267e6a7d5424fb479bc20020943d65c1b5..acc392d04633c2f9f2179dee8fd72e81c86c7c1d 100644 (file)
@@ -16,7 +16,7 @@
 #include "qemu/option.h"
 #include "qemu/range.h"
 #include "qemu/sockets.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "sysemu/sysemu.h"
 #include "libqos/libqos.h"
 #include "libqos/pci-pc.h"
index ac66b3c910c9be3b7ed818cf7c01b9087e10e59e..6cf795a23d62e99e0f1b1cd2abc675637382e547 100644 (file)
@@ -27,7 +27,7 @@
 #include "hw/qdev-core.h"
 #include "qemu/timer.h"
 #include "qmp-commands.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "trace.h"
 #include "exec/memory.h"
 
index 0213ad0efc3b10337737a4baf46650c817308953..5bd87c265abc41b8ac90e31e72d5c093e86e5711 100644 (file)
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -54,7 +54,7 @@
 #include "qmp-commands.h"
 #include "x_keymap.h"
 #include "keymaps.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qom/object.h"
 
 #define MAX_VCS 10
diff --git a/vl.c b/vl.c
index 993690d4501de4625f9648b2274e202387c9adcc..8456a944383ee15b831e106f473568afff14cd8f 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
 #include "sysemu/numa.h"
 #include "exec/gdbstub.h"
 #include "qemu/timer.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
 #include "qemu/bitmap.h"
 #include "qemu/log.h"
 #include "sysemu/blockdev.h"