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 | |
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')
-rw-r--r-- | include/block/block.h | 4 | ||||
-rw-r--r-- | include/block/block_int.h | 3 | ||||
-rw-r--r-- | include/block/blockjob.h | 17 | ||||
-rw-r--r-- | include/fpu/softfloat.h | 99 | ||||
-rw-r--r-- | include/monitor/monitor.h | 41 | ||||
-rw-r--r-- | include/qapi/qmp-event.h | 27 | ||||
-rw-r--r-- | include/qemu/sockets.h | 3 | ||||
-rw-r--r-- | include/sysemu/balloon.h | 2 | ||||
-rw-r--r-- | include/sysemu/char.h | 20 | ||||
-rw-r--r-- | include/sysemu/os-posix.h | 2 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 2 |
11 files changed, 109 insertions, 111 deletions
diff --git a/include/block/block.h b/include/block/block.h index f15b99b00b..d0baf4fb83 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -150,10 +150,6 @@ typedef enum { #define BDRV_BLOCK_ALLOCATED 0x10 #define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK -typedef enum { - BDRV_ACTION_REPORT, BDRV_ACTION_IGNORE, BDRV_ACTION_STOP -} BlockErrorAction; - typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue; typedef struct BDRVReopenState { diff --git a/include/block/block_int.h b/include/block/block_int.h index 7aa2213f77..715c761fad 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -425,9 +425,6 @@ void bdrv_attach_aio_context(BlockDriverState *bs, #ifdef _WIN32 int is_windows_drive(const char *filename); #endif -void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv, - enum MonitorEvent ev, - BlockErrorAction action, bool is_read); /** * stream_start: diff --git a/include/block/blockjob.h b/include/block/blockjob.h index c0a787530b..e443987ea8 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -217,12 +217,21 @@ void block_job_pause(BlockJob *job); void block_job_resume(BlockJob *job); /** - * qobject_from_block_job: + * block_job_event_cancle: * @job: The job whose information is requested. * - * Return a QDict corresponding to @job's query-block-jobs entry. + * Send a BLOCK_JOB_CANCELLED event for the specified job. */ -QObject *qobject_from_block_job(BlockJob *job); +void block_job_event_cancelled(BlockJob *job); + +/** + * block_job_ready: + * @job: The job which is now ready to complete. + * @msg: Error message. Only present on failure. + * + * Send a BLOCK_JOB_COMPLETED event for the specified job. + */ +void block_job_event_completed(BlockJob *job, const char *msg); /** * block_job_ready: @@ -230,7 +239,7 @@ QObject *qobject_from_block_job(BlockJob *job); * * Send a BLOCK_JOB_READY event for the specified job. */ -void block_job_ready(BlockJob *job); +void block_job_event_ready(BlockJob *job); /** * block_job_is_paused: diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 4b3090ca74..77177c5317 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -63,7 +63,6 @@ typedef uint64_t uint64; typedef int64_t int64; #define LIT64( a ) a##LL -#define INLINE static inline #define STATUS_PARAM , float_status *status #define STATUS(field) status->field @@ -181,59 +180,59 @@ typedef struct float_status { flag default_nan_mode; } float_status; -INLINE void set_float_detect_tininess(int val STATUS_PARAM) +static inline void set_float_detect_tininess(int val STATUS_PARAM) { STATUS(float_detect_tininess) = val; } -INLINE void set_float_rounding_mode(int val STATUS_PARAM) +static inline void set_float_rounding_mode(int val STATUS_PARAM) { STATUS(float_rounding_mode) = val; } -INLINE void set_float_exception_flags(int val STATUS_PARAM) +static inline void set_float_exception_flags(int val STATUS_PARAM) { STATUS(float_exception_flags) = val; } -INLINE void set_floatx80_rounding_precision(int val STATUS_PARAM) +static inline void set_floatx80_rounding_precision(int val STATUS_PARAM) { STATUS(floatx80_rounding_precision) = val; } -INLINE void set_flush_to_zero(flag val STATUS_PARAM) +static inline void set_flush_to_zero(flag val STATUS_PARAM) { STATUS(flush_to_zero) = val; } -INLINE void set_flush_inputs_to_zero(flag val STATUS_PARAM) +static inline void set_flush_inputs_to_zero(flag val STATUS_PARAM) { STATUS(flush_inputs_to_zero) = val; } -INLINE void set_default_nan_mode(flag val STATUS_PARAM) +static inline void set_default_nan_mode(flag val STATUS_PARAM) { STATUS(default_nan_mode) = val; } -INLINE int get_float_detect_tininess(float_status *status) +static inline int get_float_detect_tininess(float_status *status) { return STATUS(float_detect_tininess); } -INLINE int get_float_rounding_mode(float_status *status) +static inline int get_float_rounding_mode(float_status *status) { return STATUS(float_rounding_mode); } -INLINE int get_float_exception_flags(float_status *status) +static inline int get_float_exception_flags(float_status *status) { return STATUS(float_exception_flags); } -INLINE int get_floatx80_rounding_precision(float_status *status) +static inline int get_floatx80_rounding_precision(float_status *status) { return STATUS(floatx80_rounding_precision); } -INLINE flag get_flush_to_zero(float_status *status) +static inline flag get_flush_to_zero(float_status *status) { return STATUS(flush_to_zero); } -INLINE flag get_flush_inputs_to_zero(float_status *status) +static inline flag get_flush_inputs_to_zero(float_status *status) { return STATUS(flush_inputs_to_zero); } -INLINE flag get_default_nan_mode(float_status *status) +static inline flag get_default_nan_mode(float_status *status) { return STATUS(default_nan_mode); } @@ -284,22 +283,22 @@ float128 int64_to_float128(int64_t STATUS_PARAM); float128 uint64_to_float128(uint64_t STATUS_PARAM); /* We provide the int16 versions for symmetry of API with float-to-int */ -INLINE float32 int16_to_float32(int16_t v STATUS_PARAM) +static inline float32 int16_to_float32(int16_t v STATUS_PARAM) { return int32_to_float32(v STATUS_VAR); } -INLINE float32 uint16_to_float32(uint16_t v STATUS_PARAM) +static inline float32 uint16_to_float32(uint16_t v STATUS_PARAM) { return uint32_to_float32(v STATUS_VAR); } -INLINE float64 int16_to_float64(int16_t v STATUS_PARAM) +static inline float64 int16_to_float64(int16_t v STATUS_PARAM) { return int32_to_float64(v STATUS_VAR); } -INLINE float64 uint16_to_float64(uint16_t v STATUS_PARAM) +static inline float64 uint16_to_float64(uint16_t v STATUS_PARAM) { return uint32_to_float64(v STATUS_VAR); } @@ -319,7 +318,7 @@ int float16_is_quiet_nan( float16 ); int float16_is_signaling_nan( float16 ); float16 float16_maybe_silence_nan( float16 ); -INLINE int float16_is_any_nan(float16 a) +static inline int float16_is_any_nan(float16 a) { return ((float16_val(a) & ~0x8000) > 0x7c00); } @@ -380,7 +379,7 @@ int float32_is_signaling_nan( float32 ); float32 float32_maybe_silence_nan( float32 ); float32 float32_scalbn( float32, int STATUS_PARAM ); -INLINE float32 float32_abs(float32 a) +static inline float32 float32_abs(float32 a) { /* Note that abs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -388,7 +387,7 @@ INLINE float32 float32_abs(float32 a) return make_float32(float32_val(a) & 0x7fffffff); } -INLINE float32 float32_chs(float32 a) +static inline float32 float32_chs(float32 a) { /* Note that chs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -396,32 +395,32 @@ INLINE float32 float32_chs(float32 a) return make_float32(float32_val(a) ^ 0x80000000); } -INLINE int float32_is_infinity(float32 a) +static inline int float32_is_infinity(float32 a) { return (float32_val(a) & 0x7fffffff) == 0x7f800000; } -INLINE int float32_is_neg(float32 a) +static inline int float32_is_neg(float32 a) { return float32_val(a) >> 31; } -INLINE int float32_is_zero(float32 a) +static inline int float32_is_zero(float32 a) { return (float32_val(a) & 0x7fffffff) == 0; } -INLINE int float32_is_any_nan(float32 a) +static inline int float32_is_any_nan(float32 a) { return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL); } -INLINE int float32_is_zero_or_denormal(float32 a) +static inline int float32_is_zero_or_denormal(float32 a) { return (float32_val(a) & 0x7f800000) == 0; } -INLINE float32 float32_set_sign(float32 a, int sign) +static inline float32 float32_set_sign(float32 a, int sign) { return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31)); } @@ -490,7 +489,7 @@ int float64_is_signaling_nan( float64 ); float64 float64_maybe_silence_nan( float64 ); float64 float64_scalbn( float64, int STATUS_PARAM ); -INLINE float64 float64_abs(float64 a) +static inline float64 float64_abs(float64 a) { /* Note that abs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -498,7 +497,7 @@ INLINE float64 float64_abs(float64 a) return make_float64(float64_val(a) & 0x7fffffffffffffffLL); } -INLINE float64 float64_chs(float64 a) +static inline float64 float64_chs(float64 a) { /* Note that chs does *not* handle NaN specially, nor does * it flush denormal inputs to zero. @@ -506,32 +505,32 @@ INLINE float64 float64_chs(float64 a) return make_float64(float64_val(a) ^ 0x8000000000000000LL); } -INLINE int float64_is_infinity(float64 a) +static inline int float64_is_infinity(float64 a) { return (float64_val(a) & 0x7fffffffffffffffLL ) == 0x7ff0000000000000LL; } -INLINE int float64_is_neg(float64 a) +static inline int float64_is_neg(float64 a) { return float64_val(a) >> 63; } -INLINE int float64_is_zero(float64 a) +static inline int float64_is_zero(float64 a) { return (float64_val(a) & 0x7fffffffffffffffLL) == 0; } -INLINE int float64_is_any_nan(float64 a) +static inline int float64_is_any_nan(float64 a) { return ((float64_val(a) & ~(1ULL << 63)) > 0x7ff0000000000000ULL); } -INLINE int float64_is_zero_or_denormal(float64 a) +static inline int float64_is_zero_or_denormal(float64 a) { return (float64_val(a) & 0x7ff0000000000000LL) == 0; } -INLINE float64 float64_set_sign(float64 a, int sign) +static inline float64 float64_set_sign(float64 a, int sign) { return make_float64((float64_val(a) & 0x7fffffffffffffffULL) | ((int64_t)sign << 63)); @@ -585,39 +584,39 @@ int floatx80_is_signaling_nan( floatx80 ); floatx80 floatx80_maybe_silence_nan( floatx80 ); floatx80 floatx80_scalbn( floatx80, int STATUS_PARAM ); -INLINE floatx80 floatx80_abs(floatx80 a) +static inline floatx80 floatx80_abs(floatx80 a) { a.high &= 0x7fff; return a; } -INLINE floatx80 floatx80_chs(floatx80 a) +static inline floatx80 floatx80_chs(floatx80 a) { a.high ^= 0x8000; return a; } -INLINE int floatx80_is_infinity(floatx80 a) +static inline int floatx80_is_infinity(floatx80 a) { return (a.high & 0x7fff) == 0x7fff && a.low == 0x8000000000000000LL; } -INLINE int floatx80_is_neg(floatx80 a) +static inline int floatx80_is_neg(floatx80 a) { return a.high >> 15; } -INLINE int floatx80_is_zero(floatx80 a) +static inline int floatx80_is_zero(floatx80 a) { return (a.high & 0x7fff) == 0 && a.low == 0; } -INLINE int floatx80_is_zero_or_denormal(floatx80 a) +static inline int floatx80_is_zero_or_denormal(floatx80 a) { return (a.high & 0x7fff) == 0; } -INLINE int floatx80_is_any_nan(floatx80 a) +static inline int floatx80_is_any_nan(floatx80 a) { return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1); } @@ -670,39 +669,39 @@ int float128_is_signaling_nan( float128 ); float128 float128_maybe_silence_nan( float128 ); float128 float128_scalbn( float128, int STATUS_PARAM ); -INLINE float128 float128_abs(float128 a) +static inline float128 float128_abs(float128 a) { a.high &= 0x7fffffffffffffffLL; return a; } -INLINE float128 float128_chs(float128 a) +static inline float128 float128_chs(float128 a) { a.high ^= 0x8000000000000000LL; return a; } -INLINE int float128_is_infinity(float128 a) +static inline int float128_is_infinity(float128 a) { return (a.high & 0x7fffffffffffffffLL) == 0x7fff000000000000LL && a.low == 0; } -INLINE int float128_is_neg(float128 a) +static inline int float128_is_neg(float128 a) { return a.high >> 63; } -INLINE int float128_is_zero(float128 a) +static inline int float128_is_zero(float128 a) { return (a.high & 0x7fffffffffffffffLL) == 0 && a.low == 0; } -INLINE int float128_is_zero_or_denormal(float128 a) +static inline int float128_is_zero_or_denormal(float128 a) { return (a.high & 0x7fff000000000000LL) == 0; } -INLINE int float128_is_any_nan(float128 a) +static inline int float128_is_any_nan(float128 a) { return ((a.high >> 48) & 0x7fff) == 0x7fff && ((a.low != 0) || ((a.high & 0xffffffffffffLL) != 0)); diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 97696ea693..3d6929d6cd 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -19,49 +19,8 @@ extern Monitor *default_mon; /* flags for monitor commands */ #define MONITOR_CMD_ASYNC 0x0001 -/* QMP events */ -typedef enum MonitorEvent { - QEVENT_SHUTDOWN, - QEVENT_RESET, - QEVENT_POWERDOWN, - QEVENT_STOP, - QEVENT_RESUME, - QEVENT_VNC_CONNECTED, - QEVENT_VNC_INITIALIZED, - QEVENT_VNC_DISCONNECTED, - QEVENT_BLOCK_IO_ERROR, - QEVENT_RTC_CHANGE, - QEVENT_WATCHDOG, - QEVENT_SPICE_CONNECTED, - QEVENT_SPICE_INITIALIZED, - QEVENT_SPICE_DISCONNECTED, - QEVENT_BLOCK_JOB_COMPLETED, - QEVENT_BLOCK_JOB_CANCELLED, - QEVENT_BLOCK_JOB_ERROR, - QEVENT_BLOCK_JOB_READY, - QEVENT_DEVICE_DELETED, - QEVENT_DEVICE_TRAY_MOVED, - QEVENT_NIC_RX_FILTER_CHANGED, - QEVENT_SUSPEND, - QEVENT_SUSPEND_DISK, - QEVENT_WAKEUP, - QEVENT_BALLOON_CHANGE, - QEVENT_SPICE_MIGRATE_COMPLETED, - QEVENT_GUEST_PANICKED, - QEVENT_BLOCK_IMAGE_CORRUPTED, - QEVENT_QUORUM_FAILURE, - QEVENT_QUORUM_REPORT_BAD, - QEVENT_ACPI_OST, - - /* Add to 'monitor_event_names' array in monitor.c when - * defining new events here */ - - QEVENT_MAX, -} MonitorEvent; - int monitor_cur_is_qmp(void); -void monitor_protocol_event(MonitorEvent event, QObject *data); void monitor_init(CharDriverState *chr, int flags); int monitor_suspend(Monitor *mon); diff --git a/include/qapi/qmp-event.h b/include/qapi/qmp-event.h new file mode 100644 index 0000000000..8a8ffb5718 --- /dev/null +++ b/include/qapi/qmp-event.h @@ -0,0 +1,27 @@ +/* + * QMP Event related + * + * Copyright (c) 2014 Wenchao Xia + * + * Authors: + * Wenchao Xia <wenchaoqemu@gmail.com> + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QMP_EVENT_H +#define QMP_EVENT_H + +#include "qapi/error.h" +#include "qapi/qmp/qdict.h" + +typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error **errp); + +void qmp_event_set_func_emit(QMPEventFuncEmit emit); + +QMPEventFuncEmit qmp_event_get_func_emit(void); + +QDict *qmp_event_build_dict(const char *event_name); +#endif diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 45588d7d58..fdbb196787 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -29,6 +29,7 @@ int inet_aton(const char *cp, struct in_addr *ia); #include "qemu/option.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" +#include "qapi-types.h" extern QemuOptsList socket_optslist; @@ -60,7 +61,7 @@ int inet_nonblocking_connect(const char *str, void *opaque, Error **errp); int inet_dgram_opts(QemuOpts *opts, Error **errp); -const char *inet_strfamily(int family); +NetworkAddressFamily inet_netfamily(int family); int unix_listen_opts(QemuOpts *opts, Error **errp); int unix_listen(const char *path, char *ostr, int olen, Error **errp); diff --git a/include/sysemu/balloon.h b/include/sysemu/balloon.h index bd9d39505d..0345e01efb 100644 --- a/include/sysemu/balloon.h +++ b/include/sysemu/balloon.h @@ -24,6 +24,4 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, QEMUBalloonStatus *stat_func, void *opaque); void qemu_remove_balloon_handler(void *opaque); -void qemu_balloon_changed(int64_t actual); - #endif 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 diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 25d0b2a73f..f1315213f1 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -26,6 +26,8 @@ #ifndef QEMU_OS_POSIX_H #define QEMU_OS_POSIX_H +#include <sys/time.h> + void os_set_line_buffering(void); void os_set_proc_name(const char *s); void os_setup_signal_handling(void); diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 6b4cc133c5..285c45baf2 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -202,8 +202,6 @@ void do_usb_add(Monitor *mon, const QDict *qdict); void do_usb_del(Monitor *mon, const QDict *qdict); void usb_info(Monitor *mon, const QDict *qdict); -void rtc_change_mon_event(struct tm *tm); - void add_boot_device_path(int32_t bootindex, DeviceState *dev, const char *suffix); char *get_boot_devices_list(size_t *size, bool ignore_suffixes); |