replay-char.c (98c710f2d5cdf37f29a267352eb1f3c28cbf369d) | replay-char.c (8228e353d8906bf43399ca0ef28446c5c48bb686) |
---|---|
1/* 2 * replay-char.c 3 * 4 * Copyright (c) 2010-2016 Institute for System Programming 5 * of the Russian Academy of Sciences. 6 * 7 * This work is licensed under the terms of the GNU GPL, version 2 or later. 8 * See the COPYING file in the top-level directory. 9 * 10 */ 11 12#include "qemu/osdep.h" 13#include "qemu/error-report.h" 14#include "sysemu/replay.h" 15#include "replay-internal.h" 16#include "sysemu/sysemu.h" | 1/* 2 * replay-char.c 3 * 4 * Copyright (c) 2010-2016 Institute for System Programming 5 * of the Russian Academy of Sciences. 6 * 7 * This work is licensed under the terms of the GNU GPL, version 2 or later. 8 * See the COPYING file in the top-level directory. 9 * 10 */ 11 12#include "qemu/osdep.h" 13#include "qemu/error-report.h" 14#include "sysemu/replay.h" 15#include "replay-internal.h" 16#include "sysemu/sysemu.h" |
17#include "sysemu/char.h" | 17#include "chardev/char.h" |
18 19/* Char drivers that generate qemu_chr_be_write events 20 that should be saved into the log. */ | 18 19/* Char drivers that generate qemu_chr_be_write events 20 that should be saved into the log. */ |
21static CharDriverState **char_drivers; | 21static Chardev **char_drivers; |
22static int drivers_count; 23 24/* Char event attributes. */ 25typedef struct CharEvent { 26 int id; 27 uint8_t *buf; 28 size_t len; 29} CharEvent; 30 | 22static int drivers_count; 23 24/* Char event attributes. */ 25typedef struct CharEvent { 26 int id; 27 uint8_t *buf; 28 size_t len; 29} CharEvent; 30 |
31static int find_char_driver(CharDriverState *chr) | 31static int find_char_driver(Chardev *chr) |
32{ 33 int i = 0; 34 for ( ; i < drivers_count ; ++i) { 35 if (char_drivers[i] == chr) { 36 return i; 37 } 38 } 39 return -1; 40} 41 | 32{ 33 int i = 0; 34 for ( ; i < drivers_count ; ++i) { 35 if (char_drivers[i] == chr) { 36 return i; 37 } 38 } 39 return -1; 40} 41 |
42void replay_register_char_driver(CharDriverState *chr) | 42void replay_register_char_driver(Chardev *chr) |
43{ 44 if (replay_mode == REPLAY_MODE_NONE) { 45 return; 46 } 47 char_drivers = g_realloc(char_drivers, 48 sizeof(*char_drivers) * (drivers_count + 1)); 49 char_drivers[drivers_count++] = chr; 50} 51 | 43{ 44 if (replay_mode == REPLAY_MODE_NONE) { 45 return; 46 } 47 char_drivers = g_realloc(char_drivers, 48 sizeof(*char_drivers) * (drivers_count + 1)); 49 char_drivers[drivers_count++] = chr; 50} 51 |
52void replay_chr_be_write(CharDriverState *s, uint8_t *buf, int len) | 52void replay_chr_be_write(Chardev *s, uint8_t *buf, int len) |
53{ 54 CharEvent *event = g_malloc0(sizeof(CharEvent)); 55 56 event->id = find_char_driver(s); 57 if (event->id < 0) { 58 fprintf(stderr, "Replay: cannot find char driver\n"); 59 exit(1); 60 } --- 104 unchanged lines hidden --- | 53{ 54 CharEvent *event = g_malloc0(sizeof(CharEvent)); 55 56 event->id = find_char_driver(s); 57 if (event->id < 0) { 58 fprintf(stderr, "Replay: cannot find char driver\n"); 59 exit(1); 60 } --- 104 unchanged lines hidden --- |