diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-06-24 13:06:13 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-06-24 13:06:13 +0100 |
commit | 089a39486f2c47994c6c0d34ac7abf34baf40d9d (patch) | |
tree | 07bf9220989162df8d29b99568d13ce6d5261822 /include/sysemu/char.h | |
parent | 27acb9dd2407f41550e453b85aa5ebf1bd618b79 (diff) | |
parent | d622cb5879ca8006d5482158e4e3b272a068c301 (diff) |
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp: (43 commits)
monitor: protect event emission
monitor: protect outbuf and mux_out with mutex
qemu-char: make writes thread-safe
qemu-char: move pty_chr_update_read_handler around
qemu-char: do not call chr_write directly
qemu-char: introduce qemu_chr_alloc
qapi event: clean up
qapi event: convert QUORUM events
qapi event: convert GUEST_PANICKED
qapi event: convert BALLOON_CHANGE
qmp: convert ACPI_DEVICE_OST event
qapi event: convert SPICE events
qapi event: convert VNC events
qapi event: convert NIC_RX_FILTER_CHANGED
qapi event: convert other BLOCK_JOB events
qapi event: convert BLOCK_IMAGE_CORRUPTED
qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
qapi event: convert DEVICE_TRAY_MOVED
qapi event: convert DEVICE_DELETED
qapi event: convert WATCHDOG
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/sysemu/char.h')
-rw-r--r-- | include/sysemu/char.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/sysemu/char.h b/include/sysemu/char.h index 672ed39a31..c8b15f9729 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -54,6 +54,7 @@ typedef struct { typedef void IOEventHandler(void *opaque, int event); struct CharDriverState { + QemuMutex chr_write_lock; void (*init)(struct CharDriverState *s); int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); int (*chr_sync_read)(struct CharDriverState *s, @@ -89,6 +90,15 @@ struct CharDriverState { }; /** + * @qemu_chr_alloc: + * + * Allocate and initialize a new CharDriverState. + * + * Returns: a newly allocated CharDriverState. + */ +CharDriverState *qemu_chr_alloc(void); + +/** * @qemu_chr_new_from_opts: * * Create a new character backend from a QemuOpts list. @@ -155,6 +165,7 @@ void qemu_chr_fe_event(CharDriverState *s, int event); * @qemu_chr_fe_printf: * * Write to a character backend using a printf style interface. + * This function is thread-safe. * * @fmt see #printf */ @@ -167,8 +178,9 @@ int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, /** * @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. + * 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 @@ -183,7 +195,7 @@ int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len); * 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. + * attempted to be written. This function is thread-safe. * * @buf the data * @len the number of bytes to send @@ -207,7 +219,7 @@ int qemu_chr_fe_read_all(CharDriverState *s, uint8_t *buf, int len); /** * @qemu_chr_fe_ioctl: * - * Issue a device specific ioctl to a backend. + * Issue a device specific ioctl to a backend. This function is thread-safe. * * @cmd see CHR_IOCTL_* * @arg the data associated with @cmd |