Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

xs_wire.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Details of the "wire" protocol between Xen Store Daemon and client
  3. * library or guest kernel.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to
  7. * deal in the Software without restriction, including without limitation the
  8. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. * sell copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in
  13. * all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. *
  23. * Copyright (C) 2005 Rusty Russell IBM Corporation
  24. */
  25. #ifndef _XS_WIRE_H
  26. #define _XS_WIRE_H
  27. FILE_LICENCE ( MIT );
  28. enum xsd_sockmsg_type
  29. {
  30. XS_DEBUG,
  31. XS_DIRECTORY,
  32. XS_READ,
  33. XS_GET_PERMS,
  34. XS_WATCH,
  35. XS_UNWATCH,
  36. XS_TRANSACTION_START,
  37. XS_TRANSACTION_END,
  38. XS_INTRODUCE,
  39. XS_RELEASE,
  40. XS_GET_DOMAIN_PATH,
  41. XS_WRITE,
  42. XS_MKDIR,
  43. XS_RM,
  44. XS_SET_PERMS,
  45. XS_WATCH_EVENT,
  46. XS_ERROR,
  47. XS_IS_DOMAIN_INTRODUCED,
  48. XS_RESUME,
  49. XS_SET_TARGET,
  50. XS_RESTRICT,
  51. XS_RESET_WATCHES
  52. };
  53. #define XS_WRITE_NONE "NONE"
  54. #define XS_WRITE_CREATE "CREATE"
  55. #define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
  56. /* We hand errors as strings, for portability. */
  57. struct xsd_errors
  58. {
  59. int errnum;
  60. const char *errstring;
  61. };
  62. #ifdef EINVAL
  63. #define XSD_ERROR(x) { x, #x }
  64. /* LINTED: static unused */
  65. static struct xsd_errors xsd_errors[]
  66. #if defined(__GNUC__)
  67. __attribute__((unused))
  68. #endif
  69. = {
  70. XSD_ERROR(EINVAL),
  71. XSD_ERROR(EACCES),
  72. XSD_ERROR(EEXIST),
  73. XSD_ERROR(EISDIR),
  74. XSD_ERROR(ENOENT),
  75. XSD_ERROR(ENOMEM),
  76. XSD_ERROR(ENOSPC),
  77. XSD_ERROR(EIO),
  78. XSD_ERROR(ENOTEMPTY),
  79. XSD_ERROR(ENOSYS),
  80. XSD_ERROR(EROFS),
  81. XSD_ERROR(EBUSY),
  82. XSD_ERROR(EAGAIN),
  83. XSD_ERROR(EISCONN),
  84. XSD_ERROR(E2BIG)
  85. };
  86. #endif
  87. struct xsd_sockmsg
  88. {
  89. uint32_t type; /* XS_??? */
  90. uint32_t req_id;/* Request identifier, echoed in daemon's response. */
  91. uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */
  92. uint32_t len; /* Length of data following this. */
  93. /* Generally followed by nul-terminated string(s). */
  94. };
  95. enum xs_watch_type
  96. {
  97. XS_WATCH_PATH = 0,
  98. XS_WATCH_TOKEN
  99. };
  100. /*
  101. * `incontents 150 xenstore_struct XenStore wire protocol.
  102. *
  103. * Inter-domain shared memory communications. */
  104. #define XENSTORE_RING_SIZE 1024
  105. typedef uint32_t XENSTORE_RING_IDX;
  106. #define MASK_XENSTORE_IDX(idx) ((idx) & (XENSTORE_RING_SIZE-1))
  107. struct xenstore_domain_interface {
  108. char req[XENSTORE_RING_SIZE]; /* Requests to xenstore daemon. */
  109. char rsp[XENSTORE_RING_SIZE]; /* Replies and async watch events. */
  110. XENSTORE_RING_IDX req_cons, req_prod;
  111. XENSTORE_RING_IDX rsp_cons, rsp_prod;
  112. };
  113. /* Violating this is very bad. See docs/misc/xenstore.txt. */
  114. #define XENSTORE_PAYLOAD_MAX 4096
  115. /* Violating these just gets you an error back */
  116. #define XENSTORE_ABS_PATH_MAX 3072
  117. #define XENSTORE_REL_PATH_MAX 2048
  118. #endif /* _XS_WIRE_H */
  119. /*
  120. * Local variables:
  121. * mode: C
  122. * c-file-style: "BSD"
  123. * c-basic-offset: 4
  124. * tab-width: 4
  125. * indent-tabs-mode: nil
  126. * End:
  127. */