File: /usr/src/linux/include/linux/raid/md_compatible.h

1     
2     /*
3        md.h : Multiple Devices driver compatibility layer for Linux 2.0/2.2
4               Copyright (C) 1998 Ingo Molnar
5     	  
6        This program is free software; you can redistribute it and/or modify
7        it under the terms of the GNU General Public License as published by
8        the Free Software Foundation; either version 2, or (at your option)
9        any later version.
10        
11        You should have received a copy of the GNU General Public License
12        (for example /usr/src/linux/COPYING); if not, write to the Free
13        Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
14     */
15     
16     #include <linux/version.h>
17     
18     #ifndef _MD_COMPATIBLE_H
19     #define _MD_COMPATIBLE_H
20     
21     /** 2.3/2.4 stuff: **/
22     
23     #include <linux/reboot.h>
24     #include <linux/vmalloc.h>
25     #include <linux/blkpg.h>
26     
27     /* 000 */
28     #define md__get_free_pages(x,y) __get_free_pages(x,y)
29     
30     #if defined(__i386__) || defined(__x86_64__)
31     /* 001 */
32     static __inline__ int md_cpu_has_mmx(void)
33     {
34     	return test_bit(X86_FEATURE_MMX,  &boot_cpu_data.x86_capability);
35     }
36     #else
37     #define md_cpu_has_mmx(x)	(0)
38     #endif
39     
40     /* 002 */
41     #define md_clear_page(page)        clear_page(page)
42     
43     /* 003 */
44     #define MD_EXPORT_SYMBOL(x) EXPORT_SYMBOL(x)
45     
46     /* 004 */
47     #define md_copy_to_user(x,y,z) copy_to_user(x,y,z)
48     
49     /* 005 */
50     #define md_copy_from_user(x,y,z) copy_from_user(x,y,z)
51     
52     /* 006 */
53     #define md_put_user put_user
54     
55     /* 007 */
56     static inline int md_capable_admin(void)
57     {
58     	return capable(CAP_SYS_ADMIN);
59     }
60     
61     /* 008 */
62     #define MD_FILE_TO_INODE(file) ((file)->f_dentry->d_inode)
63     
64     /* 009 */
65     static inline void md_flush_signals (void)
66     {
67     	spin_lock(&current->sigmask_lock);
68     	flush_signals(current);
69     	spin_unlock(&current->sigmask_lock);
70     }
71      
72     /* 010 */
73     static inline void md_init_signals (void)
74     {
75             current->exit_signal = SIGCHLD;
76             siginitsetinv(&current->blocked, sigmask(SIGKILL));
77     }
78     
79     /* 011 */
80     #define md_signal_pending signal_pending
81     
82     /* 012 - md_set_global_readahead - nowhere used */
83     
84     /* 013 */
85     #define md_mdelay(x) mdelay(x)
86     
87     /* 014 */
88     #define MD_SYS_DOWN SYS_DOWN
89     #define MD_SYS_HALT SYS_HALT
90     #define MD_SYS_POWER_OFF SYS_POWER_OFF
91     
92     /* 015 */
93     #define md_register_reboot_notifier register_reboot_notifier
94     
95     /* 016 */
96     #define md_test_and_set_bit test_and_set_bit
97     
98     /* 017 */
99     #define md_test_and_clear_bit test_and_clear_bit
100     
101     /* 018 */
102     #define md_atomic_read atomic_read
103     #define md_atomic_set atomic_set
104     
105     /* 019 */
106     #define md_lock_kernel lock_kernel
107     #define md_unlock_kernel unlock_kernel
108     
109     /* 020 */
110     
111     #include <linux/init.h>
112     
113     #define md__init __init
114     #define md__initdata __initdata
115     #define md__initfunc(__arginit) __initfunc(__arginit)
116     
117     /* 021 */
118     
119     
120     /* 022 */
121     
122     #define md_list_head list_head
123     #define MD_LIST_HEAD(name) LIST_HEAD(name)
124     #define MD_INIT_LIST_HEAD(ptr) INIT_LIST_HEAD(ptr)
125     #define md_list_add list_add
126     #define md_list_del list_del
127     #define md_list_empty list_empty
128     
129     #define md_list_entry(ptr, type, member) list_entry(ptr, type, member)
130     
131     /* 023 */
132     
133     #define md_schedule_timeout schedule_timeout
134     
135     /* 024 */
136     #define md_need_resched(tsk) ((tsk)->need_resched)
137     
138     /* 025 */
139     #define md_spinlock_t spinlock_t
140     #define MD_SPIN_LOCK_UNLOCKED SPIN_LOCK_UNLOCKED
141     
142     #define md_spin_lock spin_lock
143     #define md_spin_unlock spin_unlock
144     #define md_spin_lock_irq spin_lock_irq
145     #define md_spin_unlock_irq spin_unlock_irq
146     #define md_spin_unlock_irqrestore spin_unlock_irqrestore
147     #define md_spin_lock_irqsave spin_lock_irqsave
148     
149     /* 026 */
150     typedef wait_queue_head_t md_wait_queue_head_t;
151     #define MD_DECLARE_WAITQUEUE(w,t) DECLARE_WAITQUEUE((w),(t))
152     #define MD_DECLARE_WAIT_QUEUE_HEAD(x) DECLARE_WAIT_QUEUE_HEAD(x)
153     #define md_init_waitqueue_head init_waitqueue_head
154     
155     /* END */
156     
157     #endif 
158     
159