]> git.proxmox.com Git - mirror_qemu.git/blame - tests/libqos/libqos.h
libqos: add PCI management in qtest_vboot()/qtest_shutdown()
[mirror_qemu.git] / tests / libqos / libqos.h
CommitLineData
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
90e5add6
JS
8typedef struct QOSOps {
9 QGuestAllocator *(*init_allocator)(QAllocOpts);
10 void (*uninit_allocator)(QGuestAllocator *);
2ecd7e2f
LV
11 QPCIBus *(*qpci_init)(QGuestAllocator *alloc);
12 void (*qpci_free)(QPCIBus *bus);
90e5add6
JS
13} QOSOps;
14
dd0029c0
JS
15typedef struct QOSState {
16 QTestState *qts;
17 QGuestAllocator *alloc;
2ecd7e2f 18 QPCIBus *pcibus;
90e5add6 19 QOSOps *ops;
dd0029c0
JS
20} QOSState;
21
90e5add6
JS
22QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap);
23QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...);
dd0029c0 24void qtest_shutdown(QOSState *qs);
cb11e7b2 25bool have_qemu_img(void);
122fdf2d
JS
26void mkimg(const char *file, const char *fmt, unsigned size_mb);
27void mkqcow2(const char *file, unsigned size_mb);
085248ae
JS
28void set_context(QOSState *s);
29void migrate(QOSState *from, QOSState *to, const char *uri);
72c85e94 30void prepare_blkdebug_script(const char *debug_fn, const char *event);
ab4f7057 31void generate_pattern(void *buffer, size_t len, size_t cycle_len);
dd0029c0
JS
32
33static inline uint64_t qmalloc(QOSState *q, size_t bytes)
34{
35 return guest_alloc(q->alloc, bytes);
36}
37
38static inline void qfree(QOSState *q, uint64_t addr)
39{
40 guest_free(q->alloc, addr);
41}
42
43#endif