stackglue.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* -*- mode: c; c-basic-offset: 8; -*-
  2. * vim: noexpandtab sw=8 ts=8 sts=0:
  3. *
  4. * stackglue.h
  5. *
  6. * Glue to the underlying cluster stack.
  7. *
  8. * Copyright (C) 2007 Oracle. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public
  12. * License as published by the Free Software Foundation, version 2.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. */
  19. #ifndef STACKGLUE_H
  20. #define STACKGLUE_H
  21. #include <linux/types.h>
  22. #include <linux/list.h>
  23. #include <linux/dlmconstants.h>
  24. /*
  25. * dlmconstants.h does not have a LOCAL flag. We hope to remove it
  26. * some day, but right now we need it. Let's fake it. This value is larger
  27. * than any flag in dlmconstants.h.
  28. */
  29. #define DLM_LKF_LOCAL 0x00100000
  30. /*
  31. * This shadows DLM_LOCKSPACE_LEN in fs/dlm/dlm_internal.h. That probably
  32. * wants to be in a public header.
  33. */
  34. #define GROUP_NAME_MAX 64
  35. #include "dlm/dlmapi.h"
  36. struct ocfs2_protocol_version {
  37. u8 pv_major;
  38. u8 pv_minor;
  39. };
  40. struct ocfs2_locking_protocol {
  41. struct ocfs2_protocol_version lp_max_version;
  42. void (*lp_lock_ast)(void *astarg);
  43. void (*lp_blocking_ast)(void *astarg, int level);
  44. void (*lp_unlock_ast)(void *astarg, int error);
  45. };
  46. union ocfs2_dlm_lksb {
  47. struct dlm_lockstatus lksb_o2dlm;
  48. };
  49. struct ocfs2_cluster_connection {
  50. char cc_name[GROUP_NAME_MAX];
  51. int cc_namelen;
  52. struct ocfs2_protocol_version cc_version;
  53. void (*cc_recovery_handler)(int node_num, void *recovery_data);
  54. void *cc_recovery_data;
  55. void *cc_lockspace;
  56. void *cc_private;
  57. };
  58. int ocfs2_cluster_connect(const char *group,
  59. int grouplen,
  60. void (*recovery_handler)(int node_num,
  61. void *recovery_data),
  62. void *recovery_data,
  63. struct ocfs2_cluster_connection **conn);
  64. int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn);
  65. int ocfs2_cluster_this_node(unsigned int *node);
  66. int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,
  67. int mode,
  68. union ocfs2_dlm_lksb *lksb,
  69. u32 flags,
  70. void *name,
  71. unsigned int namelen,
  72. void *astarg);
  73. int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn,
  74. union ocfs2_dlm_lksb *lksb,
  75. u32 flags,
  76. void *astarg);
  77. int ocfs2_dlm_lock_status(union ocfs2_dlm_lksb *lksb);
  78. void *ocfs2_dlm_lvb(union ocfs2_dlm_lksb *lksb);
  79. void o2cb_get_stack(struct ocfs2_locking_protocol *proto);
  80. void o2cb_put_stack(void);
  81. #endif /* STACKGLUE_H */