]> git.proxmox.com Git - mirror_qemu.git/blame - tests/qtest/libqos/libqos.h
meson: convert tests/qtest to meson
[mirror_qemu.git] / tests / qtest / libqos / libqos.h
CommitLineData
2a6a4076
MA
1#ifndef LIBQOS_H
2#define LIBQOS_H
dd0029c0
JS
3
4#include "libqtest.h"
a2ce7dbd
PB
5#include "pci.h"
6#include "malloc.h"
dd0029c0 7
61ae5cf3
LV
8typedef struct QOSState QOSState;
9
90e5add6 10typedef 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 17struct QOSState {
dd0029c0 18 QTestState *qts;
eb5937ba 19 QGuestAllocator alloc;
2ecd7e2f 20 QPCIBus *pcibus;
90e5add6 21 QOSOps *ops;
61ae5cf3 22};
dd0029c0 23
90e5add6
JS
24QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap);
25QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...);
61ae5cf3 26void qtest_common_shutdown(QOSState *qs);
dd0029c0 27void qtest_shutdown(QOSState *qs);
cb11e7b2 28bool have_qemu_img(void);
122fdf2d
JS
29void mkimg(const char *file, const char *fmt, unsigned size_mb);
30void mkqcow2(const char *file, unsigned size_mb);
085248ae 31void migrate(QOSState *from, QOSState *to, const char *uri);
72c85e94 32void prepare_blkdebug_script(const char *debug_fn, const char *event);
ab4f7057 33void generate_pattern(void *buffer, size_t len, size_t cycle_len);
dd0029c0
JS
34
35static inline uint64_t qmalloc(QOSState *q, size_t bytes)
36{
eb5937ba 37 return guest_alloc(&q->alloc, bytes);
dd0029c0
JS
38}
39
40static inline void qfree(QOSState *q, uint64_t addr)
41{
eb5937ba 42 guest_free(&q->alloc, addr);
dd0029c0
JS
43}
44
45#endif