*
*/
-#include "qtest.h"
+#include "sysemu/qtest.h"
#include "hw/qdev.h"
-#include "qemu-char.h"
-#include "ioport.h"
-#include "memory.h"
+#include "char/char.h"
+#include "exec/ioport.h"
+#include "exec/memory.h"
#include "hw/irq.h"
-#include "sysemu.h"
-#include "cpus.h"
+#include "sysemu/sysemu.h"
+#include "sysemu/cpus.h"
#define MAX_IRQ 256
static CharDriverState *qtest_chr;
static GString *inbuf;
static int irq_levels[MAX_IRQ];
-static struct timeval start_time;
+static qemu_timeval start_time;
static bool qtest_opened;
#define FMT_timeval "%ld.%06ld"
}
}
-static void qtest_get_time(struct timeval *tv)
+static void qtest_get_time(qemu_timeval *tv)
{
- gettimeofday(tv, NULL);
+ qemu_gettimeofday(tv);
tv->tv_sec -= start_time.tv_sec;
tv->tv_usec -= start_time.tv_usec;
if (tv->tv_usec < 0) {
static void qtest_send_prefix(CharDriverState *chr)
{
- struct timeval tv;
+ qemu_timeval tv;
if (!qtest_log_fp || !qtest_opened) {
return;
qtest_get_time(&tv);
fprintf(qtest_log_fp, "[S +" FMT_timeval "] ",
- tv.tv_sec, tv.tv_usec);
+ tv.tv_sec, (long) tv.tv_usec);
}
-static void qtest_send(CharDriverState *chr, const char *fmt, ...)
+static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
+ const char *fmt, ...)
{
va_list ap;
char buffer[1024];
command = words[0];
if (qtest_log_fp) {
- struct timeval tv;
+ qemu_timeval tv;
int i;
qtest_get_time(&tv);
fprintf(qtest_log_fp, "[R +" FMT_timeval "]",
- tv.tv_sec, tv.tv_usec);
+ tv.tv_sec, (long) tv.tv_usec);
for (i = 0; words[i]; i++) {
fprintf(qtest_log_fp, " %s", words[i]);
}
for (i = 0; i < ARRAY_SIZE(irq_levels); i++) {
irq_levels[i] = 0;
}
- gettimeofday(&start_time, NULL);
+ qemu_gettimeofday(&start_time);
qtest_opened = true;
if (qtest_log_fp) {
fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n",
- start_time.tv_sec, start_time.tv_usec);
+ start_time.tv_sec, (long) start_time.tv_usec);
}
break;
case CHR_EVENT_CLOSED:
qtest_opened = false;
if (qtest_log_fp) {
- struct timeval tv;
+ qemu_timeval tv;
qtest_get_time(&tv);
fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n",
- tv.tv_sec, tv.tv_usec);
+ tv.tv_sec, (long) tv.tv_usec);
}
break;
default: