mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
monitor: let mon_list be tail queue
It was QLIST. I want to use this list to do monitor priority job later, which need tail insertion ability. So switching to a tail queue. Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180309090006.10018-9-peterx@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
6adf08dd42
commit
238d9f34f4
1 changed files with 6 additions and 6 deletions
12
monitor.c
12
monitor.c
|
@ -207,7 +207,7 @@ struct Monitor {
|
||||||
void *password_opaque;
|
void *password_opaque;
|
||||||
mon_cmd_t *cmd_table;
|
mon_cmd_t *cmd_table;
|
||||||
QLIST_HEAD(,mon_fd_t) fds;
|
QLIST_HEAD(,mon_fd_t) fds;
|
||||||
QLIST_ENTRY(Monitor) entry;
|
QTAILQ_ENTRY(Monitor) entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* QMP checker flags */
|
/* QMP checker flags */
|
||||||
|
@ -216,7 +216,7 @@ struct Monitor {
|
||||||
/* Protects mon_list, monitor_event_state. */
|
/* Protects mon_list, monitor_event_state. */
|
||||||
static QemuMutex monitor_lock;
|
static QemuMutex monitor_lock;
|
||||||
|
|
||||||
static QLIST_HEAD(mon_list, Monitor) mon_list;
|
static QTAILQ_HEAD(mon_list, Monitor) mon_list;
|
||||||
static QLIST_HEAD(mon_fdsets, MonFdset) mon_fdsets;
|
static QLIST_HEAD(mon_fdsets, MonFdset) mon_fdsets;
|
||||||
static int mon_refcount;
|
static int mon_refcount;
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ static void monitor_qapi_event_emit(QAPIEvent event, QDict *qdict)
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
|
|
||||||
trace_monitor_protocol_event_emit(event, qdict);
|
trace_monitor_protocol_event_emit(event, qdict);
|
||||||
QLIST_FOREACH(mon, &mon_list, entry) {
|
QTAILQ_FOREACH(mon, &mon_list, entry) {
|
||||||
if (monitor_is_qmp(mon)
|
if (monitor_is_qmp(mon)
|
||||||
&& mon->qmp.commands != &qmp_cap_negotiation_commands) {
|
&& mon->qmp.commands != &qmp_cap_negotiation_commands) {
|
||||||
monitor_json_emitter(mon, QOBJECT(qdict));
|
monitor_json_emitter(mon, QOBJECT(qdict));
|
||||||
|
@ -4063,7 +4063,7 @@ void monitor_init(Chardev *chr, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_mutex_lock(&monitor_lock);
|
qemu_mutex_lock(&monitor_lock);
|
||||||
QLIST_INSERT_HEAD(&mon_list, mon, entry);
|
QTAILQ_INSERT_HEAD(&mon_list, mon, entry);
|
||||||
qemu_mutex_unlock(&monitor_lock);
|
qemu_mutex_unlock(&monitor_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4072,8 +4072,8 @@ void monitor_cleanup(void)
|
||||||
Monitor *mon, *next;
|
Monitor *mon, *next;
|
||||||
|
|
||||||
qemu_mutex_lock(&monitor_lock);
|
qemu_mutex_lock(&monitor_lock);
|
||||||
QLIST_FOREACH_SAFE(mon, &mon_list, entry, next) {
|
QTAILQ_FOREACH_SAFE(mon, &mon_list, entry, next) {
|
||||||
QLIST_REMOVE(mon, entry);
|
QTAILQ_REMOVE(&mon_list, mon, entry);
|
||||||
monitor_data_destroy(mon);
|
monitor_data_destroy(mon);
|
||||||
g_free(mon);
|
g_free(mon);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue