dlm.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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-2011 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 __DLM_DOT_H__
  15. #define __DLM_DOT_H__
  16. /*
  17. * Interface to Distributed Lock Manager (DLM)
  18. * routines and structures to use DLM lockspaces
  19. */
  20. /* Lock levels and flags are here */
  21. #include <linux/dlmconstants.h>
  22. #include <linux/types.h>
  23. typedef void dlm_lockspace_t;
  24. /*
  25. * Lock status block
  26. *
  27. * Use this structure to specify the contents of the lock value block. For a
  28. * conversion request, this structure is used to specify the lock ID of the
  29. * lock. DLM writes the status of the lock request and the lock ID assigned
  30. * to the request in the lock status block.
  31. *
  32. * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests.
  33. * It is available when dlm_lock returns.
  34. *
  35. * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules
  36. * shown for the DLM_LKF_VALBLK flag.
  37. *
  38. * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock,
  39. * it was first demoted to NL to avoid conversion deadlock.
  40. * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid.
  41. *
  42. * sb_status: the returned status of the lock request set prior to AST
  43. * execution. Possible return values:
  44. *
  45. * 0 if lock request was successful
  46. * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
  47. * -DLM_EUNLOCK if unlock request was successful
  48. * -DLM_ECANCEL if a cancel completed successfully
  49. * -EDEADLK if a deadlock was detected
  50. * -ETIMEDOUT if the lock request was canceled due to a timeout
  51. */
  52. #define DLM_SBF_DEMOTED 0x01
  53. #define DLM_SBF_VALNOTVALID 0x02
  54. #define DLM_SBF_ALTMODE 0x04
  55. struct dlm_lksb {
  56. int sb_status;
  57. __u32 sb_lkid;
  58. char sb_flags;
  59. char * sb_lvbptr;
  60. };
  61. /* dlm_new_lockspace() flags */
  62. /* DLM_LSFL_TIMEWARN is deprecated and reserved. DO NOT USE! */
  63. #define DLM_LSFL_TIMEWARN 0x00000002
  64. #define DLM_LSFL_NEWEXCL 0x00000008
  65. #endif /* __DLM_DOT_H__ */