util.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * Copyright (c) 2002-2003 MontaVista Software, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Author: Steven Dake (sdake@redhat.com)
  7. *
  8. * This software licensed under BSD license, the text of which follows:
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions are met:
  12. *
  13. * - Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  26. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  27. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  28. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  30. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  32. * THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #ifndef AIS_UTIL_H_DEFINED
  35. #define AIS_UTIL_H_DEFINED
  36. #include <corosync/corotypes.h>
  37. #define hdb_error_to_cs(_result_) qb_to_cs_error(_result_)
  38. #ifdef HAVE_SMALL_MEMORY_FOOTPRINT
  39. #define IPC_REQUEST_SIZE 1024*64
  40. #define IPC_RESPONSE_SIZE 1024*64
  41. #define IPC_DISPATCH_SIZE 1024*64
  42. #else
  43. #define IPC_REQUEST_SIZE 8192*128
  44. #define IPC_RESPONSE_SIZE 8192*128
  45. #define IPC_DISPATCH_SIZE 8192*128
  46. #endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
  47. static inline const char * cs_strerror(cs_error_t err)
  48. {
  49. switch (err) {
  50. case CS_OK:
  51. return "success";
  52. case CS_ERR_LIBRARY:
  53. return "CS_ERR_LIBRARY";
  54. case CS_ERR_VERSION:
  55. return "CS_ERR_VERSION";
  56. case CS_ERR_INIT:
  57. return "CS_ERR_INIT";
  58. case CS_ERR_NO_MEMORY:
  59. return "CS_ERR_NO_MEMORY";
  60. case CS_ERR_NAME_TOO_LONG :
  61. return "CS_ERR_NAME_TOO_LONG ";
  62. case CS_ERR_TIMEOUT:
  63. return "CS_ERR_TIMEOUT";
  64. case CS_ERR_TRY_AGAIN:
  65. return "CS_ERR_TRY_AGAIN";
  66. case CS_ERR_INVALID_PARAM:
  67. return "CS_ERR_INVALID_PARAM";
  68. case CS_ERR_BAD_HANDLE:
  69. return "CS_ERR_BAD_HANDLE";
  70. case CS_ERR_BUSY :
  71. return "CS_ERR_BUSY ";
  72. case CS_ERR_ACCESS :
  73. return "CS_ERR_ACCESS ";
  74. case CS_ERR_NOT_EXIST :
  75. return "CS_ERR_NOT_EXIST ";
  76. case CS_ERR_EXIST :
  77. return "CS_ERR_EXIST ";
  78. case CS_ERR_NO_SPACE :
  79. return "CS_ERR_NO_SPACE ";
  80. case CS_ERR_INTERRUPT :
  81. return "CS_ERR_INTERRUPT ";
  82. case CS_ERR_NAME_NOT_FOUND :
  83. return "CS_ERR_NAME_NOT_FOUND ";
  84. case CS_ERR_NO_RESOURCES :
  85. return "CS_ERR_NO_RESOURCES ";
  86. case CS_ERR_NOT_SUPPORTED :
  87. return "CS_ERR_NOT_SUPPORTED ";
  88. case CS_ERR_BAD_OPERATION :
  89. return "CS_ERR_BAD_OPERATION ";
  90. case CS_ERR_FAILED_OPERATION :
  91. return "CS_ERR_FAILED_OPERATION ";
  92. case CS_ERR_MESSAGE_ERROR :
  93. return "CS_ERR_MESSAGE_ERROR ";
  94. case CS_ERR_QUEUE_FULL :
  95. return "CS_ERR_QUEUE_FULL ";
  96. case CS_ERR_QUEUE_NOT_AVAILABLE :
  97. return "CS_ERR_QUEUE_NOT_AVAILABLE ";
  98. case CS_ERR_BAD_FLAGS :
  99. return "CS_ERR_BAD_FLAGS ";
  100. case CS_ERR_TOO_BIG :
  101. return "CS_ERR_TOO_BIG ";
  102. case CS_ERR_NO_SECTIONS :
  103. return "CS_ERR_NO_SECTIONS ";
  104. case CS_ERR_CONTEXT_NOT_FOUND :
  105. return "CS_ERR_CONTEXT_NOT_FOUND ";
  106. case CS_ERR_TOO_MANY_GROUPS :
  107. return "CS_ERR_TOO_MANY_GROUPS ";
  108. case CS_ERR_SECURITY :
  109. return "CS_ERR_SECURITY ";
  110. default:
  111. return "unknown error";
  112. }
  113. }
  114. #endif /* AIS_UTIL_H_DEFINED */