Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 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 | |
| 20 | |
| 21 | #ifndef STACKGLUE_H |
| 22 | #define STACKGLUE_H |
| 23 | |
Joel Becker | bd3e761 | 2008-02-01 12:14:57 -0800 | [diff] [blame] | 24 | #include <linux/types.h> |
| 25 | #include <linux/list.h> |
| 26 | #include <linux/dlmconstants.h> |
| 27 | |
| 28 | /* |
| 29 | * dlmconstants.h does not have a LOCAL flag. We hope to remove it |
| 30 | * some day, but right now we need it. Let's fake it. This value is larger |
| 31 | * than any flag in dlmconstants.h. |
| 32 | */ |
| 33 | #define DLM_LKF_LOCAL 0x00100000 |
| 34 | |
Joel Becker | 4670c46 | 2008-02-01 14:39:35 -0800 | [diff] [blame] | 35 | /* |
| 36 | * This shadows DLM_LOCKSPACE_LEN in fs/dlm/dlm_internal.h. That probably |
| 37 | * wants to be in a public header. |
| 38 | */ |
| 39 | #define GROUP_NAME_MAX 64 |
| 40 | |
| 41 | |
Joel Becker | bd3e761 | 2008-02-01 12:14:57 -0800 | [diff] [blame] | 42 | #include "dlm/dlmapi.h" |
| 43 | |
Joel Becker | 4670c46 | 2008-02-01 14:39:35 -0800 | [diff] [blame] | 44 | struct ocfs2_protocol_version { |
| 45 | u8 pv_major; |
| 46 | u8 pv_minor; |
| 47 | }; |
| 48 | |
Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 49 | struct ocfs2_locking_protocol { |
Joel Becker | 4670c46 | 2008-02-01 14:39:35 -0800 | [diff] [blame] | 50 | struct ocfs2_protocol_version lp_max_version; |
Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 51 | void (*lp_lock_ast)(void *astarg); |
| 52 | void (*lp_blocking_ast)(void *astarg, int level); |
Joel Becker | 7431cd7 | 2008-02-01 12:15:37 -0800 | [diff] [blame] | 53 | void (*lp_unlock_ast)(void *astarg, int error); |
Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 54 | }; |
| 55 | |
Joel Becker | 8f2c9c1 | 2008-02-01 12:16:57 -0800 | [diff] [blame] | 56 | union ocfs2_dlm_lksb { |
| 57 | struct dlm_lockstatus lksb_o2dlm; |
| 58 | }; |
| 59 | |
Joel Becker | 4670c46 | 2008-02-01 14:39:35 -0800 | [diff] [blame] | 60 | struct ocfs2_cluster_connection { |
| 61 | char cc_name[GROUP_NAME_MAX]; |
| 62 | int cc_namelen; |
| 63 | struct ocfs2_protocol_version cc_version; |
| 64 | void (*cc_recovery_handler)(int node_num, void *recovery_data); |
| 65 | void *cc_recovery_data; |
| 66 | void *cc_lockspace; |
| 67 | void *cc_private; |
| 68 | }; |
| 69 | |
| 70 | int ocfs2_cluster_connect(const char *group, |
| 71 | int grouplen, |
| 72 | void (*recovery_handler)(int node_num, |
| 73 | void *recovery_data), |
| 74 | void *recovery_data, |
| 75 | struct ocfs2_cluster_connection **conn); |
| 76 | int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn); |
Joel Becker | 6953b4c | 2008-01-29 16:59:56 -0800 | [diff] [blame] | 77 | void ocfs2_cluster_hangup(const char *group, int grouplen); |
Joel Becker | 19fdb62 | 2008-01-30 15:38:24 -0800 | [diff] [blame] | 78 | int ocfs2_cluster_this_node(unsigned int *node); |
Joel Becker | 4670c46 | 2008-02-01 14:39:35 -0800 | [diff] [blame] | 79 | |
| 80 | int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn, |
Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 81 | int mode, |
Joel Becker | 8f2c9c1 | 2008-02-01 12:16:57 -0800 | [diff] [blame] | 82 | union ocfs2_dlm_lksb *lksb, |
Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 83 | u32 flags, |
| 84 | void *name, |
| 85 | unsigned int namelen, |
| 86 | void *astarg); |
Joel Becker | 4670c46 | 2008-02-01 14:39:35 -0800 | [diff] [blame] | 87 | int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn, |
Joel Becker | 8f2c9c1 | 2008-02-01 12:16:57 -0800 | [diff] [blame] | 88 | union ocfs2_dlm_lksb *lksb, |
Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 89 | u32 flags, |
| 90 | void *astarg); |
| 91 | |
Joel Becker | 8f2c9c1 | 2008-02-01 12:16:57 -0800 | [diff] [blame] | 92 | int ocfs2_dlm_lock_status(union ocfs2_dlm_lksb *lksb); |
| 93 | void *ocfs2_dlm_lvb(union ocfs2_dlm_lksb *lksb); |
| 94 | |
Joel Becker | 24ef181 | 2008-01-29 17:37:32 -0800 | [diff] [blame] | 95 | void o2cb_get_stack(struct ocfs2_locking_protocol *proto); |
| 96 | void o2cb_put_stack(void); |
| 97 | |
| 98 | #endif /* STACKGLUE_H */ |