]>
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" | |
6 | #include "libqos/malloc-pc.h" | |
7 | ||
61ae5cf3 LV |
8 | typedef struct QOSState QOSState; |
9 | ||
90e5add6 JS |
10 | typedef struct QOSOps { |
11 | QGuestAllocator *(*init_allocator)(QAllocOpts); | |
12 | void (*uninit_allocator)(QGuestAllocator *); | |
2ecd7e2f LV |
13 | QPCIBus *(*qpci_init)(QGuestAllocator *alloc); |
14 | void (*qpci_free)(QPCIBus *bus); | |
61ae5cf3 | 15 | void (*shutdown)(QOSState *); |
90e5add6 JS |
16 | } QOSOps; |
17 | ||
61ae5cf3 | 18 | struct QOSState { |
dd0029c0 JS |
19 | QTestState *qts; |
20 | QGuestAllocator *alloc; | |
2ecd7e2f | 21 | QPCIBus *pcibus; |
90e5add6 | 22 | QOSOps *ops; |
61ae5cf3 | 23 | }; |
dd0029c0 | 24 | |
90e5add6 JS |
25 | QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap); |
26 | QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...); | |
61ae5cf3 | 27 | void qtest_common_shutdown(QOSState *qs); |
dd0029c0 | 28 | void qtest_shutdown(QOSState *qs); |
cb11e7b2 | 29 | bool have_qemu_img(void); |
122fdf2d JS |
30 | void mkimg(const char *file, const char *fmt, unsigned size_mb); |
31 | void mkqcow2(const char *file, unsigned size_mb); | |
085248ae JS |
32 | void set_context(QOSState *s); |
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 | { | |
39 | return guest_alloc(q->alloc, bytes); | |
40 | } | |
41 | ||
42 | static inline void qfree(QOSState *q, uint64_t addr) | |
43 | { | |
44 | guest_free(q->alloc, addr); | |
45 | } | |
46 | ||
47 | #endif |