]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - fs/ocfs2/stackglue.c
ocfs2: Separate out dlm lock functions.
[linux-2.6-omap-h63xx.git] / fs / ocfs2 / stackglue.c
1 /* -*- mode: c; c-basic-offset: 8; -*-
2  * vim: noexpandtab sw=8 ts=8 sts=0:
3  *
4  * stackglue.c
5  *
6  * Code which implements an OCFS2 specific interface to underlying
7  * cluster stacks.
8  *
9  * Copyright (C) 2007 Oracle.  All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public
13  * License as published by the Free Software Foundation, version 2.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  */
20
21 #include <linux/types.h>
22 #include <linux/list.h>
23
24 #include "dlm/dlmapi.h"
25
26 #include "stackglue.h"
27
28 static struct ocfs2_locking_protocol *lproto;
29
30 enum dlm_status ocfs2_dlm_lock(struct dlm_ctxt *dlm,
31                    int mode,
32                    struct dlm_lockstatus *lksb,
33                    u32 flags,
34                    void *name,
35                    unsigned int namelen,
36                    void *astarg)
37 {
38         BUG_ON(lproto == NULL);
39         return dlmlock(dlm, mode, lksb, flags, name, namelen,
40                        lproto->lp_lock_ast, astarg,
41                        lproto->lp_blocking_ast);
42 }
43
44 enum dlm_status ocfs2_dlm_unlock(struct dlm_ctxt *dlm,
45                      struct dlm_lockstatus *lksb,
46                      u32 flags,
47                      void *astarg)
48 {
49         BUG_ON(lproto == NULL);
50
51         return dlmunlock(dlm, lksb, flags, lproto->lp_unlock_ast, astarg);
52 }
53
54
55 void o2cb_get_stack(struct ocfs2_locking_protocol *proto)
56 {
57         BUG_ON(proto == NULL);
58
59         lproto = proto;
60 }
61
62 void o2cb_put_stack(void)
63 {
64         lproto = NULL;
65 }