vhost-user-backend.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * QEMU vhost-user backend
  3. *
  4. * Copyright (C) 2018 Red Hat Inc
  5. *
  6. * Authors:
  7. * Marc-André Lureau <marcandre.lureau@redhat.com>
  8. *
  9. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  10. * See the COPYING file in the top-level directory.
  11. */
  12. #ifndef QEMU_VHOST_USER_BACKEND_H
  13. #define QEMU_VHOST_USER_BACKEND_H
  14. #include "qom/object.h"
  15. #include "exec/memory.h"
  16. #include "qemu/option.h"
  17. #include "qemu/bitmap.h"
  18. #include "hw/virtio/vhost.h"
  19. #include "hw/virtio/vhost-user.h"
  20. #include "chardev/char-fe.h"
  21. #include "io/channel.h"
  22. #define TYPE_VHOST_USER_BACKEND "vhost-user-backend"
  23. OBJECT_DECLARE_SIMPLE_TYPE(VhostUserBackend,
  24. VHOST_USER_BACKEND)
  25. struct VhostUserBackend {
  26. /* private */
  27. Object parent;
  28. char *chr_name;
  29. CharBackend chr;
  30. VhostUserState vhost_user;
  31. struct vhost_dev dev;
  32. VirtIODevice *vdev;
  33. bool started;
  34. bool completed;
  35. };
  36. int vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev,
  37. unsigned nvqs, Error **errp);
  38. void vhost_user_backend_start(VhostUserBackend *b);
  39. void vhost_user_backend_stop(VhostUserBackend *b);
  40. #endif