qemu/tests/libqos/libqos.h
<<
>>
Prefs
   1#ifndef LIBQOS_H
   2#define LIBQOS_H
   3
   4#include "libqtest.h"
   5#include "libqos/pci.h"
   6#include "libqos/malloc-pc.h"
   7
   8typedef struct QOSState QOSState;
   9
  10typedef struct QOSOps {
  11    QGuestAllocator *(*init_allocator)(QTestState *qts, QAllocOpts);
  12    void (*uninit_allocator)(QGuestAllocator *);
  13    QPCIBus *(*qpci_init)(QTestState *qts, QGuestAllocator *alloc);
  14    void (*qpci_free)(QPCIBus *bus);
  15    void (*shutdown)(QOSState *);
  16} QOSOps;
  17
  18struct QOSState {
  19    QTestState *qts;
  20    QGuestAllocator *alloc;
  21    QPCIBus *pcibus;
  22    QOSOps *ops;
  23};
  24
  25QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap);
  26QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt, ...);
  27void qtest_common_shutdown(QOSState *qs);
  28void qtest_shutdown(QOSState *qs);
  29bool have_qemu_img(void);
  30void mkimg(const char *file, const char *fmt, unsigned size_mb);
  31void mkqcow2(const char *file, unsigned size_mb);
  32void set_context(QOSState *s);
  33void migrate(QOSState *from, QOSState *to, const char *uri);
  34void prepare_blkdebug_script(const char *debug_fn, const char *event);
  35void generate_pattern(void *buffer, size_t len, size_t cycle_len);
  36
  37static inline uint64_t qmalloc(QOSState *q, size_t bytes)
  38{
  39    return guest_alloc(q->alloc, bytes);
  40}
  41
  42static inline void qfree(QOSState *q, uint64_t addr)
  43{
  44    guest_free(q->alloc, addr);
  45}
  46
  47#endif
  48