dlm_device.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 _LINUX_DLM_DEVICE_H
  14. #define _LINUX_DLM_DEVICE_H
  15. /* This is the device interface for dlm, most users will use a library
  16. * interface.
  17. */
  18. #include <linux/dlm.h>
  19. #include <linux/types.h>
  20. #define DLM_USER_LVB_LEN 32
  21. /* Version of the device interface */
  22. #define DLM_DEVICE_VERSION_MAJOR 6
  23. #define DLM_DEVICE_VERSION_MINOR 0
  24. #define DLM_DEVICE_VERSION_PATCH 2
  25. /* struct passed to the lock write */
  26. struct dlm_lock_params {
  27. __u8 mode;
  28. __u8 namelen;
  29. __u16 unused;
  30. __u32 flags;
  31. __u32 lkid;
  32. __u32 parent;
  33. __u64 xid;
  34. __u64 timeout;
  35. void *castparam;
  36. void *castaddr;
  37. void *bastparam;
  38. void *bastaddr;
  39. struct dlm_lksb *lksb;
  40. char lvb[DLM_USER_LVB_LEN];
  41. char name[0];
  42. };
  43. struct dlm_lspace_params {
  44. __u32 flags;
  45. __u32 minor;
  46. char name[0];
  47. };
  48. struct dlm_purge_params {
  49. __u32 nodeid;
  50. __u32 pid;
  51. };
  52. struct dlm_write_request {
  53. __u32 version[3];
  54. __u8 cmd;
  55. __u8 is64bit;
  56. __u8 unused[2];
  57. union {
  58. struct dlm_lock_params lock;
  59. struct dlm_lspace_params lspace;
  60. struct dlm_purge_params purge;
  61. } i;
  62. };
  63. struct dlm_device_version {
  64. __u32 version[3];
  65. };
  66. /* struct read from the "device" fd,
  67. consists mainly of userspace pointers for the library to use */
  68. struct dlm_lock_result {
  69. __u32 version[3];
  70. __u32 length;
  71. void * user_astaddr;
  72. void * user_astparam;
  73. struct dlm_lksb * user_lksb;
  74. struct dlm_lksb lksb;
  75. __u8 bast_mode;
  76. __u8 unused[3];
  77. /* Offsets may be zero if no data is present */
  78. __u32 lvb_offset;
  79. };
  80. /* Commands passed to the device */
  81. #define DLM_USER_LOCK 1
  82. #define DLM_USER_UNLOCK 2
  83. #define DLM_USER_QUERY 3
  84. #define DLM_USER_CREATE_LOCKSPACE 4
  85. #define DLM_USER_REMOVE_LOCKSPACE 5
  86. #define DLM_USER_PURGE 6
  87. #define DLM_USER_DEADLOCK 7
  88. /* Lockspace flags */
  89. #define DLM_USER_LSFLG_AUTOFREE 1
  90. #define DLM_USER_LSFLG_FORCEFREE 2
  91. #endif