ipc_votequorum.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * Copyright (c) 2009-2012 Red Hat, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Authors: Christine Caulfield (ccaulfie@redhat.com)
  7. * Fabio M. Di Nitto (fdinitto@redhat.com)
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. #ifndef IPC_VOTEQUORUM_H_DEFINED
  36. #define IPC_VOTEQUORUM_H_DEFINED
  37. #include <corosync/mar_gen.h>
  38. #define VOTEQUORUM_MAX_QDEVICE_NAME_LEN 255
  39. enum req_votequorum_types {
  40. MESSAGE_REQ_VOTEQUORUM_GETINFO = 0,
  41. MESSAGE_REQ_VOTEQUORUM_SETEXPECTED,
  42. MESSAGE_REQ_VOTEQUORUM_SETVOTES,
  43. MESSAGE_REQ_VOTEQUORUM_TRACKSTART,
  44. MESSAGE_REQ_VOTEQUORUM_TRACKSTOP,
  45. MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER,
  46. MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER,
  47. MESSAGE_REQ_VOTEQUORUM_QDEVICE_UPDATE,
  48. MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL
  49. };
  50. enum res_votequorum_types {
  51. MESSAGE_RES_VOTEQUORUM_STATUS = 0,
  52. MESSAGE_RES_VOTEQUORUM_GETINFO,
  53. MESSAGE_RES_VOTEQUORUM_TRACKSTART,
  54. MESSAGE_RES_VOTEQUORUM_NOTIFICATION,
  55. MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
  56. };
  57. struct req_lib_votequorum_qdevice_register {
  58. struct qb_ipc_request_header header __attribute__((aligned(8)));
  59. char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  60. };
  61. struct req_lib_votequorum_qdevice_unregister {
  62. struct qb_ipc_request_header header __attribute__((aligned(8)));
  63. char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  64. };
  65. struct req_lib_votequorum_qdevice_update {
  66. struct qb_ipc_request_header header __attribute__((aligned(8)));
  67. char oldname[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  68. char newname[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  69. };
  70. struct req_lib_votequorum_qdevice_poll {
  71. struct qb_ipc_request_header header __attribute__((aligned(8)));
  72. char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  73. int cast_vote;
  74. };
  75. struct req_lib_votequorum_setvotes {
  76. struct qb_ipc_request_header header __attribute__((aligned(8)));
  77. unsigned int votes;
  78. int nodeid;
  79. };
  80. struct req_lib_votequorum_setexpected {
  81. struct qb_ipc_request_header header __attribute__((aligned(8)));
  82. unsigned int expected_votes;
  83. };
  84. struct req_lib_votequorum_trackstart {
  85. struct qb_ipc_request_header header __attribute__((aligned(8)));
  86. uint64_t context;
  87. unsigned int track_flags;
  88. };
  89. struct req_lib_votequorum_general {
  90. struct qb_ipc_request_header header __attribute__((aligned(8)));
  91. };
  92. struct req_lib_votequorum_getinfo {
  93. struct qb_ipc_request_header header __attribute__((aligned(8)));
  94. int nodeid;
  95. };
  96. struct res_lib_votequorum_status {
  97. struct qb_ipc_response_header header __attribute__((aligned(8)));
  98. };
  99. #define VOTEQUORUM_INFO_TWONODE 1
  100. #define VOTEQUORUM_INFO_QUORATE 2
  101. #define VOTEQUORUM_INFO_WAIT_FOR_ALL 4
  102. #define VOTEQUORUM_INFO_LAST_MAN_STANDING 8
  103. #define VOTEQUORUM_INFO_AUTO_TIE_BREAKER 16
  104. #define VOTEQUORUM_INFO_ALLOW_DOWNSCALE 32
  105. #define VOTEQUORUM_INFO_QDEVICE_REGISTERED 64
  106. #define VOTEQUORUM_INFO_QDEVICE_ALIVE 128
  107. #define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE 256
  108. #define VOTEQUORUM_NODESTATE_MEMBER 1
  109. #define VOTEQUORUM_NODESTATE_DEAD 2
  110. #define VOTEQUORUM_NODESTATE_LEAVING 3
  111. struct res_lib_votequorum_getinfo {
  112. struct qb_ipc_response_header header __attribute__((aligned(8)));
  113. unsigned int nodeid;
  114. unsigned int state;
  115. unsigned int votes;
  116. unsigned int expected_votes;
  117. unsigned int highest_expected;
  118. unsigned int total_votes;
  119. unsigned int quorum;
  120. unsigned int flags;
  121. unsigned int qdevice_votes;
  122. char qdevice_name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  123. };
  124. struct votequorum_node {
  125. mar_uint32_t nodeid;
  126. mar_uint32_t state;
  127. };
  128. struct res_lib_votequorum_notification {
  129. struct qb_ipc_response_header header __attribute__((aligned(8)));
  130. mar_uint32_t quorate __attribute__((aligned(8)));
  131. mar_uint64_t context __attribute__((aligned(8)));
  132. mar_uint32_t node_list_entries __attribute__((aligned(8)));
  133. struct votequorum_node node_list[] __attribute__((aligned(8)));
  134. };
  135. struct res_lib_votequorum_expectedvotes_notification {
  136. struct qb_ipc_response_header header __attribute__((aligned(8)));
  137. mar_uint64_t context __attribute__((aligned(8)));
  138. mar_uint32_t expected_votes __attribute__((aligned(8)));
  139. };
  140. #endif