dlmconstants.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /******************************************************************************
  2. *******************************************************************************
  3. **
  4. ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  5. ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
  6. **
  7. ** This copyrighted material is made available to anyone wishing to use,
  8. ** modify, copy, or redistribute it subject to the terms and conditions
  9. ** of the GNU General Public License v.2.
  10. **
  11. *******************************************************************************
  12. ******************************************************************************/
  13. #ifndef __DLMCONSTANTS_DOT_H__
  14. #define __DLMCONSTANTS_DOT_H__
  15. /*
  16. * Constants used by DLM interface.
  17. */
  18. /*
  19. * Lock Modes
  20. */
  21. #define DLM_LOCK_IV (-1) /* invalid */
  22. #define DLM_LOCK_NL 0 /* null */
  23. #define DLM_LOCK_CR 1 /* concurrent read */
  24. #define DLM_LOCK_CW 2 /* concurrent write */
  25. #define DLM_LOCK_PR 3 /* protected read */
  26. #define DLM_LOCK_PW 4 /* protected write */
  27. #define DLM_LOCK_EX 5 /* exclusive */
  28. /*
  29. * Flags to dlm_lock
  30. *
  31. * DLM_LKF_NOQUEUE
  32. *
  33. * Do not queue the lock request on the wait queue if it cannot be granted
  34. * immediately. If the lock cannot be granted because of this flag, DLM will
  35. * either return -EAGAIN from the dlm_lock call or will return 0 from
  36. * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
  37. *
  38. * DLM_LKF_CANCEL
  39. *
  40. * Used to cancel a pending lock request or conversion. A converting lock is
  41. * returned to its previously granted mode.
  42. *
  43. * DLM_LKF_CONVERT
  44. *
  45. * Indicates a lock conversion request. For conversions the name and namelen
  46. * are ignored and the lock ID in the LKSB is used to identify the lock.
  47. *
  48. * DLM_LKF_VALBLK
  49. *
  50. * Requests DLM to return the current contents of the lock value block in the
  51. * lock status block. When this flag is set in a lock conversion from PW or EX
  52. * modes, DLM assigns the value specified in the lock status block to the lock
  53. * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
  54. * containing application-specific information.
  55. *
  56. * DLM_LKF_QUECVT
  57. *
  58. * Force a conversion request to be queued, even if it is compatible with
  59. * the granted modes of other locks on the same resource.
  60. *
  61. * DLM_LKF_IVVALBLK
  62. *
  63. * Invalidate the lock value block.
  64. *
  65. * DLM_LKF_CONVDEADLK
  66. *
  67. * Allows the dlm to resolve conversion deadlocks internally by demoting the
  68. * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
  69. * returned for a conversion that's been effected by this.
  70. *
  71. * DLM_LKF_PERSISTENT
  72. *
  73. * Only relevant to locks originating in userspace. A persistent lock will not
  74. * be removed if the process holding the lock exits.
  75. *
  76. * DLM_LKF_NODLCKWT
  77. *
  78. * Do not cancel the lock if it gets into conversion deadlock.
  79. * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
  80. *
  81. * DLM_LKF_NODLCKBLK
  82. *
  83. * net yet implemented
  84. *
  85. * DLM_LKF_EXPEDITE
  86. *
  87. * Used only with new requests for NL mode locks. Tells the lock manager
  88. * to grant the lock, ignoring other locks in convert and wait queues.
  89. *
  90. * DLM_LKF_NOQUEUEBAST
  91. *
  92. * Send blocking AST's before returning -EAGAIN to the caller. It is only
  93. * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
  94. * NOQUEUE requests otherwise.
  95. *
  96. * DLM_LKF_HEADQUE
  97. *
  98. * Add a lock to the head of the convert or wait queue rather than the tail.
  99. *
  100. * DLM_LKF_NOORDER
  101. *
  102. * Disregard the standard grant order rules and grant a lock as soon as it
  103. * is compatible with other granted locks.
  104. *
  105. * DLM_LKF_ORPHAN
  106. *
  107. * not yet implemented
  108. *
  109. * DLM_LKF_ALTPR
  110. *
  111. * If the requested mode cannot be granted immediately, try to grant the lock
  112. * in PR mode instead. If this alternate mode is granted instead of the
  113. * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
  114. *
  115. * DLM_LKF_ALTCW
  116. *
  117. * The same as ALTPR, but the alternate mode is CW.
  118. *
  119. * DLM_LKF_FORCEUNLOCK
  120. *
  121. * Unlock the lock even if it is converting or waiting or has sublocks.
  122. * Only really for use by the userland device.c code.
  123. *
  124. */
  125. #define DLM_LKF_NOQUEUE 0x00000001
  126. #define DLM_LKF_CANCEL 0x00000002
  127. #define DLM_LKF_CONVERT 0x00000004
  128. #define DLM_LKF_VALBLK 0x00000008
  129. #define DLM_LKF_QUECVT 0x00000010
  130. #define DLM_LKF_IVVALBLK 0x00000020
  131. #define DLM_LKF_CONVDEADLK 0x00000040
  132. #define DLM_LKF_PERSISTENT 0x00000080
  133. #define DLM_LKF_NODLCKWT 0x00000100
  134. #define DLM_LKF_NODLCKBLK 0x00000200
  135. #define DLM_LKF_EXPEDITE 0x00000400
  136. #define DLM_LKF_NOQUEUEBAST 0x00000800
  137. #define DLM_LKF_HEADQUE 0x00001000
  138. #define DLM_LKF_NOORDER 0x00002000
  139. #define DLM_LKF_ORPHAN 0x00004000
  140. #define DLM_LKF_ALTPR 0x00008000
  141. #define DLM_LKF_ALTCW 0x00010000
  142. #define DLM_LKF_FORCEUNLOCK 0x00020000
  143. #define DLM_LKF_TIMEOUT 0x00040000
  144. /*
  145. * Some return codes that are not in errno.h
  146. */
  147. #define DLM_ECANCEL 0x10001
  148. #define DLM_EUNLOCK 0x10002
  149. #endif /* __DLMCONSTANTS_DOT_H__ */