This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / kernel / ckrm / ckrm_tasks_stub.c
1 /* ckrm_tasks_stub.c - Stub file for ckrm_tasks modules
2  *
3  * Copyright (C) Chandra Seetharaman,  IBM Corp. 2004
4  * 
5  * Latest version, more details at http://ckrm.sf.net
6  * 
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  */
13
14 /* Changes
15  * 
16  * 16 May 2004: Created
17  * 
18  */
19
20 #include <linux/spinlock.h>
21 #include <linux/module.h>
22 #include <linux/ckrm_tsk.h>
23
24 static spinlock_t stub_lock = SPIN_LOCK_UNLOCKED;
25
26 static get_ref_t real_get_ref = NULL;
27 static put_ref_t real_put_ref = NULL;
28
29 void ckrm_numtasks_register(get_ref_t gr, put_ref_t pr)
30 {
31         spin_lock(&stub_lock);
32         real_get_ref = gr;
33         real_put_ref = pr;
34         spin_unlock(&stub_lock);
35 }
36
37 int numtasks_get_ref(void *arg, int force)
38 {
39         int ret = 1;
40         spin_lock(&stub_lock);
41         if (real_get_ref) {
42                 ret = (*real_get_ref) (arg, force);
43         }
44         spin_unlock(&stub_lock);
45         return ret;
46 }
47
48 void numtasks_put_ref(void *arg)
49 {
50         spin_lock(&stub_lock);
51         if (real_put_ref) {
52                 (*real_put_ref) (arg);
53         }
54         spin_unlock(&stub_lock);
55 }
56
57 EXPORT_SYMBOL(ckrm_numtasks_register);
58 EXPORT_SYMBOL(numtasks_get_ref);
59 EXPORT_SYMBOL(numtasks_put_ref);