ipc_lck.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright (c) 2002-2005 MontaVista Software, Inc.
  3. * Copyright (c) 2006 Sun Microsystems, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Author: Steven Dake (sdake@mvista.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 CONTRIBUTORS "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_LCK_H_DEFINED
  36. #define IPC_LCK_H_DEFINED
  37. #include "saAis.h"
  38. #include "saLck.h"
  39. #include "ipc_gen.h"
  40. #include "swab.h"
  41. enum req_lib_lck_resource_types {
  42. MESSAGE_REQ_LCK_RESOURCEOPEN = 0,
  43. MESSAGE_REQ_LCK_RESOURCEOPENASYNC = 1,
  44. MESSAGE_REQ_LCK_RESOURCECLOSE = 2,
  45. MESSAGE_REQ_LCK_RESOURCELOCK = 3,
  46. MESSAGE_REQ_LCK_RESOURCELOCKASYNC = 4,
  47. MESSAGE_REQ_LCK_RESOURCEUNLOCK = 5,
  48. MESSAGE_REQ_LCK_RESOURCEUNLOCKASYNC = 6,
  49. MESSAGE_REQ_LCK_LOCKPURGE = 7,
  50. };
  51. enum res_lib_lck_resource_types {
  52. MESSAGE_RES_LCK_RESOURCEOPEN = 0,
  53. MESSAGE_RES_LCK_RESOURCEOPENASYNC = 1,
  54. MESSAGE_RES_LCK_RESOURCECLOSE = 2,
  55. MESSAGE_RES_LCK_RESOURCELOCK = 3,
  56. MESSAGE_RES_LCK_RESOURCELOCKASYNC = 4,
  57. MESSAGE_RES_LCK_RESOURCEUNLOCK = 5,
  58. MESSAGE_RES_LCK_RESOURCEUNLOCKASYNC = 6,
  59. MESSAGE_RES_LCK_LOCKPURGE = 7,
  60. MESSAGE_RES_LCK_LOCKWAITERCALLBACK = 8
  61. };
  62. struct req_lib_lck_resourceopen {
  63. mar_req_header_t header;
  64. SaInvocationT invocation;
  65. mar_name_t lockResourceName;
  66. SaLckResourceOpenFlagsT resourceOpenFlags;
  67. SaLckResourceHandleT resourceHandle;
  68. SaTimeT timeout;
  69. int async_call;
  70. };
  71. struct res_lib_lck_resourceopen {
  72. mar_res_header_t header;
  73. SaLckResourceHandleT resourceHandle;
  74. mar_message_source_t source;
  75. };
  76. struct res_lib_lck_resourceopenasync {
  77. mar_res_header_t header;
  78. SaInvocationT invocation;
  79. SaLckResourceHandleT resourceHandle;
  80. mar_message_source_t source;
  81. };
  82. struct req_lib_lck_resourceclose {
  83. mar_req_header_t header;
  84. mar_name_t lockResourceName;
  85. SaLckResourceHandleT resourceHandle;
  86. };
  87. struct res_lib_lck_resourceclose {
  88. mar_res_header_t header;
  89. };
  90. struct req_lib_lck_resourcelock {
  91. mar_req_header_t header;
  92. mar_name_t lockResourceName;
  93. SaInvocationT invocation;
  94. SaLckLockModeT lockMode;
  95. SaLckLockFlagsT lockFlags;
  96. SaLckWaiterSignalT waiterSignal;
  97. SaTimeT timeout;
  98. SaLckLockIdT lockId;
  99. int async_call;
  100. mar_message_source_t source;
  101. SaLckResourceHandleT resourceHandle;
  102. };
  103. static inline void swab_req_lib_lck_resourcelock (
  104. struct req_lib_lck_resourcelock *to_swab)
  105. {
  106. swab_mar_req_header_t (&to_swab->header);
  107. swab_mar_name_t (&to_swab->lockResourceName);
  108. to_swab->invocation = swab64 (to_swab->invocation);
  109. to_swab->lockMode = swab64 (to_swab->lockMode);
  110. to_swab->lockFlags = swab32 (to_swab->lockFlags);
  111. to_swab->waiterSignal = swab64 (to_swab->waiterSignal);
  112. to_swab->timeout = swab64 (to_swab->timeout);
  113. to_swab->lockId = swab64 (to_swab->lockId);
  114. to_swab->async_call = swab32 (to_swab->async_call);
  115. swab_mar_message_source_t (&to_swab->source);
  116. to_swab->resourceHandle = swab64 (to_swab->resourceHandle);
  117. }
  118. struct res_lib_lck_resourcelock {
  119. mar_res_header_t header;
  120. SaLckLockStatusT lockStatus;
  121. void *resource_lock;
  122. };
  123. struct res_lib_lck_resourcelockasync {
  124. mar_res_header_t header;
  125. SaLckLockStatusT lockStatus;
  126. SaLckLockIdT lockId;
  127. void *resource_lock;
  128. SaInvocationT invocation;
  129. SaLckResourceHandleT resourceHandle;
  130. };
  131. struct req_lib_lck_resourceunlock {
  132. mar_req_header_t header;
  133. mar_name_t lockResourceName;
  134. SaLckLockIdT lockId;
  135. SaInvocationT invocation;
  136. SaTimeT timeout;
  137. int async_call;
  138. void *resource_lock;
  139. };
  140. struct res_lib_lck_resourceunlock {
  141. mar_res_header_t header;
  142. };
  143. struct res_lib_lck_resourceunlockasync {
  144. mar_res_header_t header;
  145. SaInvocationT invocation;
  146. SaLckLockIdT lockId;
  147. };
  148. struct req_lib_lck_lockpurge {
  149. mar_req_header_t header;
  150. mar_name_t lockResourceName;
  151. };
  152. static inline void swab_req_lib_lck_lockpurge (
  153. struct req_lib_lck_lockpurge *to_swab)
  154. {
  155. swab_mar_req_header_t (&to_swab->header);
  156. swab_mar_name_t (&to_swab->lockResourceName);
  157. }
  158. struct res_lib_lck_lockpurge {
  159. mar_res_header_t header;
  160. };
  161. struct res_lib_lck_lockwaitercallback {
  162. mar_res_header_t header;
  163. SaLckWaiterSignalT waiter_signal;
  164. SaLckLockIdT lock_id;
  165. SaLckLockModeT mode_held;
  166. SaLckLockModeT mode_requested;
  167. };
  168. #endif /* IPC_LCK_H_DEFINED */