1dd0029c0SJohn Snow #ifndef __libqos_h 2dd0029c0SJohn Snow #define __libqos_h 3dd0029c0SJohn Snow 4dd0029c0SJohn Snow #include "libqtest.h" 5dd0029c0SJohn Snow #include "libqos/pci.h" 6dd0029c0SJohn Snow #include "libqos/malloc-pc.h" 7dd0029c0SJohn Snow 890e5add6SJohn Snow typedef struct QOSOps { 990e5add6SJohn Snow QGuestAllocator *(*init_allocator)(QAllocOpts); 1090e5add6SJohn Snow void (*uninit_allocator)(QGuestAllocator *); 1190e5add6SJohn Snow } QOSOps; 1290e5add6SJohn Snow 13dd0029c0SJohn Snow typedef struct QOSState { 14dd0029c0SJohn Snow QTestState *qts; 15dd0029c0SJohn Snow QGuestAllocator *alloc; 1690e5add6SJohn Snow QOSOps *ops; 17dd0029c0SJohn Snow } QOSState; 18dd0029c0SJohn Snow 1990e5add6SJohn Snow QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap); 2090e5add6SJohn Snow QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...); 21dd0029c0SJohn Snow void qtest_shutdown(QOSState *qs); 22*cb11e7b2SJohn Snow bool have_qemu_img(void); 23122fdf2dSJohn Snow void mkimg(const char *file, const char *fmt, unsigned size_mb); 24122fdf2dSJohn Snow void mkqcow2(const char *file, unsigned size_mb); 25085248aeSJohn Snow void set_context(QOSState *s); 26085248aeSJohn Snow void migrate(QOSState *from, QOSState *to, const char *uri); 2772c85e94SJohn Snow void prepare_blkdebug_script(const char *debug_fn, const char *event); 28ab4f7057SJohn Snow void generate_pattern(void *buffer, size_t len, size_t cycle_len); 29dd0029c0SJohn Snow 30dd0029c0SJohn Snow static inline uint64_t qmalloc(QOSState *q, size_t bytes) 31dd0029c0SJohn Snow { 32dd0029c0SJohn Snow return guest_alloc(q->alloc, bytes); 33dd0029c0SJohn Snow } 34dd0029c0SJohn Snow 35dd0029c0SJohn Snow static inline void qfree(QOSState *q, uint64_t addr) 36dd0029c0SJohn Snow { 37dd0029c0SJohn Snow guest_free(q->alloc, addr); 38dd0029c0SJohn Snow } 39dd0029c0SJohn Snow 40dd0029c0SJohn Snow #endif 41