c325d8e8d06e7ee4af4a00985cd216506a2c7d54
[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
29
30 void cki_cfq_set(icls_tsk_t tskicls, icls_ioprio_t tskioprio)
31 {
32         spin_lock(&stub_lock);
33         tskiclstub = tskicls;
34         tskiopriostub = tskioprio;
35         spin_unlock(&stub_lock);
36 }
37
38 void *cki_hash_key(struct task_struct *tsk)
39 {
40         void *ret;
41         spin_lock(&stub_lock);
42         if (tskiclstub)
43                 ret = (*tskiclstub)(tsk);
44         else 
45                 ret = (void *) tsk->tgid;
46         spin_unlock(&stub_lock);
47         return ret;
48 }
49
50 int cki_ioprio(struct task_struct *tsk)
51 {
52         int ret;
53         spin_lock(&stub_lock);
54         if (tskiopriostub) 
55                 ret = (*tskiopriostub)(tsk);
56         else 
57                 ret = tsk->ioprio;
58         spin_unlock(&stub_lock);
59         return ret;
60 }
61
62 EXPORT_SYMBOL(cki_cfq_set);
63 EXPORT_SYMBOL(cki_hash_key);
64 EXPORT_SYMBOL(cki_ioprio);