This commit was manufactured by cvs2svn to create branch
[linux-2.6.git] / drivers / block / ckrm-iostub.c
1 /* ckrm-iostub.c - Stub file for ckrm_io module
2  *
3  * Copyright (C) Shailabh Nagar,  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  * 07 Aug 2004: Created
17  * 
18  */
19
20 #include <linux/spinlock.h>
21 #include <linux/module.h>
22 #include <linux/ckrm-io.h>
23
24 static spinlock_t stub_lock = SPIN_LOCK_UNLOCKED;
25
26 static icls_tsk_t tskiclstub;
27 static icls_ioprio_t tskiopriostub;
28 static icls_tsk_t tskcfqprivstub;
29
30 void cki_cfq_set(icls_tsk_t tskicls, icls_ioprio_t tskioprio, icls_tsk_t tskcfqpriv)
31 {
32         spin_lock(&stub_lock);
33         tskiclstub = tskicls;
34         tskiopriostub = tskioprio;
35         tskcfqprivstub = tskcfqpriv;
36         spin_unlock(&stub_lock);
37 }
38
39 void *cki_hash_key(struct task_struct *tsk)
40 {
41         void *ret;
42         spin_lock(&stub_lock);
43         if (tskiclstub)
44                 ret = (*tskiclstub)(tsk);
45         else 
46                 ret = (void *) tsk->tgid;
47         spin_unlock(&stub_lock);
48         return ret;
49 }
50
51 int cki_ioprio(struct task_struct *tsk)
52 {
53         int ret;
54         spin_lock(&stub_lock);
55         if (tskiopriostub) 
56                 ret = (*tskiopriostub)(tsk);
57         else 
58                 ret = tsk->ioprio;
59         spin_unlock(&stub_lock);
60         return ret;
61 }
62
63 void *cki_cfqpriv(struct task_struct *tsk)
64 {
65         void *ret;
66         spin_lock(&stub_lock);
67         if (tskiclstub)
68                 ret = (*tskcfqprivstub)(tsk);
69         else 
70                 ret = NULL;
71         spin_unlock(&stub_lock);
72         return ret;
73 }    
74
75 EXPORT_SYMBOL(cki_cfq_set);
76 EXPORT_SYMBOL(cki_hash_key);
77 EXPORT_SYMBOL(cki_ioprio);
78 EXPORT_SYMBOL(cki_cfqpriv);