Lines Matching +full:event +full:-

2  * replay-events.c
4 * Copyright (c) 2010-2015 Institute for System Programming
8 * See the COPYING file in the top-level directory.
13 #include "qemu/error-report.h"
15 #include "replay-internal.h"
20 typedef struct Event { struct
26 QTAILQ_ENTRY(Event) events; argument
27 } Event; typedef
29 static QTAILQ_HEAD(, Event) events_list = QTAILQ_HEAD_INITIALIZER(events_list);
34 static void replay_run_event(Event *event) in replay_run_event() argument
36 switch (event->event_kind) { in replay_run_event()
38 aio_bh_call(event->opaque); in replay_run_event()
41 ((QEMUBHFunc *)event->opaque)(event->opaque2); in replay_run_event()
44 qemu_input_event_send_impl(NULL, (InputEvent *)event->opaque); in replay_run_event()
45 qapi_free_InputEvent((InputEvent *)event->opaque); in replay_run_event()
51 replay_event_char_read_run(event->opaque); in replay_run_event()
54 aio_bh_call(event->opaque); in replay_run_event()
57 replay_event_net_run(event->opaque); in replay_run_event()
60 error_report("Replay: invalid async event ID (%d) in the queue", in replay_run_event()
61 event->event_kind); in replay_run_event()
88 Event *event = QTAILQ_FIRST(&events_list); in replay_flush_events() local
89 replay_run_event(event); in replay_flush_events()
90 QTAILQ_REMOVE(&events_list, event, events); in replay_flush_events()
91 g_free(event); in replay_flush_events()
95 /*! Adds specified async event to the queue */
104 Event e; in replay_add_event()
113 Event *event = g_new0(Event, 1); in replay_add_event() local
114 event->event_kind = event_kind; in replay_add_event()
115 event->opaque = opaque; in replay_add_event()
116 event->opaque2 = opaque2; in replay_add_event()
117 event->id = id; in replay_add_event()
120 QTAILQ_INSERT_TAIL(&events_list, event, events); in replay_add_event()
145 void replay_add_input_event(struct InputEvent *event) in replay_add_input_event() argument
147 replay_add_event(REPLAY_ASYNC_EVENT_INPUT, event, NULL, 0); in replay_add_input_event()
164 static void replay_save_event(Event *event) in replay_save_event() argument
167 /* put the event into the file */ in replay_save_event()
168 g_assert(event->event_kind < REPLAY_ASYNC_COUNT); in replay_save_event()
169 replay_put_event(EVENT_ASYNC + event->event_kind); in replay_save_event()
171 /* save event-specific data */ in replay_save_event()
172 switch (event->event_kind) { in replay_save_event()
175 replay_put_qword(event->id); in replay_save_event()
178 replay_save_input_event(event->opaque); in replay_save_event()
183 replay_event_char_read_save(event->opaque); in replay_save_event()
186 replay_put_qword(event->id); in replay_save_event()
189 replay_event_net_save(event->opaque); in replay_save_event()
192 error_report("Unknown ID %" PRId64 " of replay event", event->id); in replay_save_event()
203 Event *event = QTAILQ_FIRST(&events_list); in replay_save_events() local
204 replay_save_event(event); in replay_save_events()
205 replay_run_event(event); in replay_save_events()
206 QTAILQ_REMOVE(&events_list, event, events); in replay_save_events()
207 g_free(event); in replay_save_events()
211 static Event *replay_read_event(void) in replay_read_event()
213 Event *event; in replay_read_event() local
214 ReplayAsyncEventKind event_kind = replay_state.data_kind - EVENT_ASYNC; in replay_read_event()
220 if (replay_state.read_event_id == -1) { in replay_read_event()
225 event = g_new0(Event, 1); in replay_read_event()
226 event->event_kind = event_kind; in replay_read_event()
227 event->opaque = replay_read_input_event(); in replay_read_event()
228 return event; in replay_read_event()
230 event = g_new0(Event, 1); in replay_read_event()
231 event->event_kind = event_kind; in replay_read_event()
232 event->opaque = 0; in replay_read_event()
233 return event; in replay_read_event()
235 event = g_new0(Event, 1); in replay_read_event()
236 event->event_kind = event_kind; in replay_read_event()
237 event->opaque = replay_event_char_read_load(); in replay_read_event()
238 return event; in replay_read_event()
240 if (replay_state.read_event_id == -1) { in replay_read_event()
245 event = g_new0(Event, 1); in replay_read_event()
246 event->event_kind = event_kind; in replay_read_event()
247 event->opaque = replay_event_net_load(); in replay_read_event()
248 return event; in replay_read_event()
250 error_report("Unknown ID %d of replay event", event_kind); in replay_read_event()
255 QTAILQ_FOREACH(event, &events_list, events) { in replay_read_event()
256 if (event->event_kind == event_kind in replay_read_event()
257 && (replay_state.read_event_id == -1 in replay_read_event()
258 || replay_state.read_event_id == event->id)) { in replay_read_event()
263 if (event) { in replay_read_event()
264 QTAILQ_REMOVE(&events_list, event, events); in replay_read_event()
267 return event; in replay_read_event()
276 Event *event = replay_read_event(); in replay_read_events() local
277 if (!event) { in replay_read_events()
281 replay_state.read_event_id = -1; in replay_read_events()
282 replay_run_event(event); in replay_read_events()
284 g_free(event); in replay_read_events()
290 replay_state.read_event_id = -1; in replay_init_events()