xen-bus-helper.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2018 Citrix Systems Inc.
  3. *
  4. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  5. * See the COPYING file in the top-level directory.
  6. */
  7. #ifndef HW_XEN_BUS_HELPER_H
  8. #define HW_XEN_BUS_HELPER_H
  9. #include "hw/xen/xen_backend_ops.h"
  10. const char *xs_strstate(enum xenbus_state state);
  11. void xs_node_create(struct qemu_xs_handle *h, xs_transaction_t tid,
  12. const char *node, unsigned int owner, unsigned int domid,
  13. unsigned int perms, Error **errp);
  14. void xs_node_destroy(struct qemu_xs_handle *h, xs_transaction_t tid,
  15. const char *node, Error **errp);
  16. /* Write to node/key unless node is empty, in which case write to key */
  17. void xs_node_vprintf(struct qemu_xs_handle *h, xs_transaction_t tid,
  18. const char *node, const char *key, Error **errp,
  19. const char *fmt, va_list ap)
  20. G_GNUC_PRINTF(6, 0);
  21. void xs_node_printf(struct qemu_xs_handle *h, xs_transaction_t tid,
  22. const char *node, const char *key, Error **errp,
  23. const char *fmt, ...)
  24. G_GNUC_PRINTF(6, 7);
  25. /* Read from node/key unless node is empty, in which case read from key */
  26. int xs_node_vscanf(struct qemu_xs_handle *h, xs_transaction_t tid,
  27. const char *node, const char *key, Error **errp,
  28. const char *fmt, va_list ap)
  29. G_GNUC_SCANF(6, 0);
  30. int xs_node_scanf(struct qemu_xs_handle *h, xs_transaction_t tid,
  31. const char *node, const char *key, Error **errp,
  32. const char *fmt, ...)
  33. G_GNUC_SCANF(6, 7);
  34. /*
  35. * Unlike other functions here, the printf-formatted path_fmt is for
  36. * the XenStore path, not the contents of the node.
  37. */
  38. char *xs_node_read(struct qemu_xs_handle *h, xs_transaction_t tid,
  39. unsigned int *len, Error **errp,
  40. const char *path_fmt, ...)
  41. G_GNUC_PRINTF(5, 6);
  42. /* Watch node/key unless node is empty, in which case watch key */
  43. struct qemu_xs_watch *xs_node_watch(struct qemu_xs_handle *h, const char *node,
  44. const char *key, xs_watch_fn fn,
  45. void *opaque, Error **errp);
  46. void xs_node_unwatch(struct qemu_xs_handle *h, struct qemu_xs_watch *w);
  47. #endif /* HW_XEN_BUS_HELPER_H */