]>
Commit | Line | Data |
---|---|---|
2a6a4076 MA |
1 | #ifndef LIBQOS_H |
2 | #define LIBQOS_H | |
dd0029c0 | 3 | |
907b5105 | 4 | #include "../libqtest.h" |
a2ce7dbd | 5 | #include "pci.h" |
b243c73c | 6 | #include "libqos-malloc.h" |
dd0029c0 | 7 | |
61ae5cf3 LV |
8 | typedef struct QOSState QOSState; |
9 | ||
90e5add6 | 10 | typedef struct QOSOps { |
eb5937ba | 11 | void (*alloc_init)(QGuestAllocator *, QTestState *, QAllocOpts); |
143e6db6 | 12 | QPCIBus *(*qpci_new)(QTestState *qts, QGuestAllocator *alloc); |
2ecd7e2f | 13 | void (*qpci_free)(QPCIBus *bus); |
61ae5cf3 | 14 | void (*shutdown)(QOSState *); |
90e5add6 JS |
15 | } QOSOps; |
16 | ||
61ae5cf3 | 17 | struct QOSState { |
dd0029c0 | 18 | QTestState *qts; |
eb5937ba | 19 | QGuestAllocator alloc; |
2ecd7e2f | 20 | QPCIBus *pcibus; |
90e5add6 | 21 | QOSOps *ops; |
61ae5cf3 | 22 | }; |
dd0029c0 | 23 | |
0472b2e5 DB |
24 | QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap) |
25 | G_GNUC_PRINTF(2, 0); | |
26 | QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...) | |
27 | G_GNUC_PRINTF(2, 3); | |
61ae5cf3 | 28 | void qtest_common_shutdown(QOSState *qs); |
dd0029c0 | 29 | void qtest_shutdown(QOSState *qs); |
cb11e7b2 | 30 | bool have_qemu_img(void); |
122fdf2d JS |
31 | void mkimg(const char *file, const char *fmt, unsigned size_mb); |
32 | void mkqcow2(const char *file, unsigned size_mb); | |
085248ae | 33 | void migrate(QOSState *from, QOSState *to, const char *uri); |
72c85e94 | 34 | void prepare_blkdebug_script(const char *debug_fn, const char *event); |
ab4f7057 | 35 | void generate_pattern(void *buffer, size_t len, size_t cycle_len); |
dd0029c0 JS |
36 | |
37 | static inline uint64_t qmalloc(QOSState *q, size_t bytes) | |
38 | { | |
eb5937ba | 39 | return guest_alloc(&q->alloc, bytes); |
dd0029c0 JS |
40 | } |
41 | ||
42 | static inline void qfree(QOSState *q, uint64_t addr) | |
43 | { | |
eb5937ba | 44 | guest_free(&q->alloc, addr); |
dd0029c0 JS |
45 | } |
46 | ||
47 | #endif |