dlmconstants.h 5.0 KB

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