blob: 3c91e241892b10fa8f1988c8b67589cf843f76bc [file] [log] [blame]
Joel Becker24ef1812008-01-29 17:37:32 -08001/* -*- 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 Beckerbd3e7612008-02-01 12:14:57 -080024#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
35#include "dlm/dlmapi.h"
36
Joel Becker24ef1812008-01-29 17:37:32 -080037struct ocfs2_locking_protocol {
38 void (*lp_lock_ast)(void *astarg);
39 void (*lp_blocking_ast)(void *astarg, int level);
Joel Becker7431cd72008-02-01 12:15:37 -080040 void (*lp_unlock_ast)(void *astarg, int error);
Joel Becker24ef1812008-01-29 17:37:32 -080041};
42
Joel Becker8f2c9c12008-02-01 12:16:57 -080043union ocfs2_dlm_lksb {
44 struct dlm_lockstatus lksb_o2dlm;
45};
46
Joel Becker7431cd72008-02-01 12:15:37 -080047int ocfs2_dlm_lock(struct dlm_ctxt *dlm,
Joel Becker24ef1812008-01-29 17:37:32 -080048 int mode,
Joel Becker8f2c9c12008-02-01 12:16:57 -080049 union ocfs2_dlm_lksb *lksb,
Joel Becker24ef1812008-01-29 17:37:32 -080050 u32 flags,
51 void *name,
52 unsigned int namelen,
53 void *astarg);
Joel Becker7431cd72008-02-01 12:15:37 -080054int ocfs2_dlm_unlock(struct dlm_ctxt *dlm,
Joel Becker8f2c9c12008-02-01 12:16:57 -080055 union ocfs2_dlm_lksb *lksb,
Joel Becker24ef1812008-01-29 17:37:32 -080056 u32 flags,
57 void *astarg);
58
Joel Becker8f2c9c12008-02-01 12:16:57 -080059int ocfs2_dlm_lock_status(union ocfs2_dlm_lksb *lksb);
60void *ocfs2_dlm_lvb(union ocfs2_dlm_lksb *lksb);
61
Joel Becker24ef1812008-01-29 17:37:32 -080062void o2cb_get_stack(struct ocfs2_locking_protocol *proto);
63void o2cb_put_stack(void);
64
65#endif /* STACKGLUE_H */