ipc_votequorum.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. MESSAGE_REQ_VOTEQUORUM_QDEVICE_MASTER_WINS
  50. };
  51. enum res_votequorum_types {
  52. MESSAGE_RES_VOTEQUORUM_STATUS = 0,
  53. MESSAGE_RES_VOTEQUORUM_GETINFO,
  54. MESSAGE_RES_VOTEQUORUM_TRACKSTART,
  55. MESSAGE_RES_VOTEQUORUM_NOTIFICATION,
  56. MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
  57. };
  58. struct req_lib_votequorum_qdevice_register {
  59. struct qb_ipc_request_header header __attribute__((aligned(8)));
  60. char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  61. };
  62. struct req_lib_votequorum_qdevice_unregister {
  63. struct qb_ipc_request_header header __attribute__((aligned(8)));
  64. char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  65. };
  66. struct req_lib_votequorum_qdevice_update {
  67. struct qb_ipc_request_header header __attribute__((aligned(8)));
  68. char oldname[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  69. char newname[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  70. };
  71. struct req_lib_votequorum_qdevice_poll {
  72. struct qb_ipc_request_header header __attribute__((aligned(8)));
  73. char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  74. int cast_vote;
  75. };
  76. struct req_lib_votequorum_qdevice_master_wins {
  77. struct qb_ipc_request_header header __attribute__((aligned(8)));
  78. char name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  79. unsigned int allow;
  80. };
  81. struct req_lib_votequorum_setvotes {
  82. struct qb_ipc_request_header header __attribute__((aligned(8)));
  83. unsigned int votes;
  84. int nodeid;
  85. };
  86. struct req_lib_votequorum_setexpected {
  87. struct qb_ipc_request_header header __attribute__((aligned(8)));
  88. unsigned int expected_votes;
  89. };
  90. struct req_lib_votequorum_trackstart {
  91. struct qb_ipc_request_header header __attribute__((aligned(8)));
  92. uint64_t context;
  93. unsigned int track_flags;
  94. };
  95. struct req_lib_votequorum_general {
  96. struct qb_ipc_request_header header __attribute__((aligned(8)));
  97. };
  98. struct req_lib_votequorum_getinfo {
  99. struct qb_ipc_request_header header __attribute__((aligned(8)));
  100. int nodeid;
  101. };
  102. struct res_lib_votequorum_status {
  103. struct qb_ipc_response_header header __attribute__((aligned(8)));
  104. };
  105. #define VOTEQUORUM_INFO_TWONODE 1
  106. #define VOTEQUORUM_INFO_QUORATE 2
  107. #define VOTEQUORUM_INFO_WAIT_FOR_ALL 4
  108. #define VOTEQUORUM_INFO_LAST_MAN_STANDING 8
  109. #define VOTEQUORUM_INFO_AUTO_TIE_BREAKER 16
  110. #define VOTEQUORUM_INFO_ALLOW_DOWNSCALE 32
  111. #define VOTEQUORUM_INFO_QDEVICE_REGISTERED 64
  112. #define VOTEQUORUM_INFO_QDEVICE_ALIVE 128
  113. #define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE 256
  114. #define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS 512
  115. #define VOTEQUORUM_NODESTATE_MEMBER 1
  116. #define VOTEQUORUM_NODESTATE_DEAD 2
  117. #define VOTEQUORUM_NODESTATE_LEAVING 3
  118. struct res_lib_votequorum_getinfo {
  119. struct qb_ipc_response_header header __attribute__((aligned(8)));
  120. unsigned int nodeid;
  121. unsigned int state;
  122. unsigned int votes;
  123. unsigned int expected_votes;
  124. unsigned int highest_expected;
  125. unsigned int total_votes;
  126. unsigned int quorum;
  127. unsigned int flags;
  128. unsigned int qdevice_votes;
  129. char qdevice_name[VOTEQUORUM_MAX_QDEVICE_NAME_LEN];
  130. };
  131. struct votequorum_node {
  132. mar_uint32_t nodeid;
  133. mar_uint32_t state;
  134. };
  135. struct res_lib_votequorum_notification {
  136. struct qb_ipc_response_header header __attribute__((aligned(8)));
  137. mar_uint32_t quorate __attribute__((aligned(8)));
  138. mar_uint64_t context __attribute__((aligned(8)));
  139. mar_uint32_t node_list_entries __attribute__((aligned(8)));
  140. struct votequorum_node node_list[] __attribute__((aligned(8)));
  141. };
  142. struct res_lib_votequorum_expectedvotes_notification {
  143. struct qb_ipc_response_header header __attribute__((aligned(8)));
  144. mar_uint64_t context __attribute__((aligned(8)));
  145. mar_uint32_t expected_votes __attribute__((aligned(8)));
  146. };
  147. #endif