Refactor aio callback allocation to use an aiocb pool (Avi Kivity)
[sniper_test.git] / qemu-tool.c
blobc08f061be81e29d084ea89f07b0640a12cb0c5fb
1 /*
2 * Compatibility for qemu-img/qemu-nbd
4 * Copyright IBM, Corp. 2008
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu-common.h"
15 #include "monitor.h"
16 #include "sysemu.h"
17 #include "qemu-timer.h"
19 #include <sys/time.h>
21 QEMUClock *rt_clock;
23 struct QEMUBH
25 QEMUBHFunc *cb;
26 void *opaque;
29 void qemu_service_io(void)
33 Monitor *cur_mon;
35 void monitor_printf(Monitor *mon, const char *fmt, ...)
39 void monitor_print_filename(Monitor *mon, const char *filename)
43 QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
45 QEMUBH *bh;
47 bh = qemu_malloc(sizeof(*bh));
48 bh->cb = cb;
49 bh->opaque = opaque;
51 return bh;
54 int qemu_bh_poll(void)
56 return 0;
59 void qemu_bh_schedule(QEMUBH *bh)
61 bh->cb(bh->opaque);
64 void qemu_bh_cancel(QEMUBH *bh)
68 void qemu_bh_delete(QEMUBH *bh)
70 qemu_free(bh);
73 int qemu_set_fd_handler2(int fd,
74 IOCanRWHandler *fd_read_poll,
75 IOHandler *fd_read,
76 IOHandler *fd_write,
77 void *opaque)
79 return 0;
82 int64_t qemu_get_clock(QEMUClock *clock)
84 qemu_timeval tv;
85 qemu_gettimeofday(&tv);
86 return (tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000)) / 1000000;