qemu-tool.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Compatibility for qemu-img/qemu-nbd
  3. *
  4. * Copyright IBM, Corp. 2008
  5. *
  6. * Authors:
  7. * Anthony Liguori <aliguori@us.ibm.com>
  8. *
  9. * This work is licensed under the terms of the GNU GPL, version 2. See
  10. * the COPYING file in the top-level directory.
  11. *
  12. */
  13. #include "qemu-common.h"
  14. #include "console.h"
  15. #include "sysemu.h"
  16. #include "qemu-timer.h"
  17. #include <sys/time.h>
  18. QEMUClock *rt_clock;
  19. struct QEMUBH
  20. {
  21. QEMUBHFunc *cb;
  22. void *opaque;
  23. };
  24. void qemu_service_io(void)
  25. {
  26. }
  27. void term_printf(const char *fmt, ...)
  28. {
  29. }
  30. void term_print_filename(const char *filename)
  31. {
  32. }
  33. QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
  34. {
  35. QEMUBH *bh;
  36. bh = qemu_malloc(sizeof(*bh));
  37. bh->cb = cb;
  38. bh->opaque = opaque;
  39. return bh;
  40. }
  41. int qemu_bh_poll(void)
  42. {
  43. return 0;
  44. }
  45. void qemu_bh_schedule(QEMUBH *bh)
  46. {
  47. bh->cb(bh->opaque);
  48. }
  49. void qemu_bh_cancel(QEMUBH *bh)
  50. {
  51. }
  52. void qemu_bh_delete(QEMUBH *bh)
  53. {
  54. qemu_free(bh);
  55. }
  56. int qemu_set_fd_handler2(int fd,
  57. IOCanRWHandler *fd_read_poll,
  58. IOHandler *fd_read,
  59. IOHandler *fd_write,
  60. void *opaque)
  61. {
  62. return 0;
  63. }
  64. int64_t qemu_get_clock(QEMUClock *clock)
  65. {
  66. qemu_timeval tv;
  67. qemu_gettimeofday(&tv);
  68. return (tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000)) / 1000000;
  69. }