]>
Commit | Line | Data |
---|---|---|
2a6a4076 MA |
1 | #ifndef LIBQOS_H |
2 | #define LIBQOS_H | |
dd0029c0 JS |
3 | |
4 | #include "libqtest.h" | |
5 | #include "libqos/pci.h" | |
eb5937ba | 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 | |
90e5add6 JS |
24 | QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap); |
25 | QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...); | |
61ae5cf3 | 26 | void qtest_common_shutdown(QOSState *qs); |
dd0029c0 | 27 | void qtest_shutdown(QOSState *qs); |
cb11e7b2 | 28 | bool have_qemu_img(void); |
122fdf2d JS |
29 | void mkimg(const char *file, const char *fmt, unsigned size_mb); |
30 | void mkqcow2(const char *file, unsigned size_mb); | |
085248ae | 31 | void migrate(QOSState *from, QOSState *to, const char *uri); |
72c85e94 | 32 | void prepare_blkdebug_script(const char *debug_fn, const char *event); |
ab4f7057 | 33 | void generate_pattern(void *buffer, size_t len, size_t cycle_len); |
dd0029c0 JS |
34 | |
35 | static inline uint64_t qmalloc(QOSState *q, size_t bytes) | |
36 | { | |
eb5937ba | 37 | return guest_alloc(&q->alloc, bytes); |
dd0029c0 JS |
38 | } |
39 | ||
40 | static inline void qfree(QOSState *q, uint64_t addr) | |
41 | { | |
eb5937ba | 42 | guest_free(&q->alloc, addr); |
dd0029c0 JS |
43 | } |
44 | ||
45 | #endif |