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 */
32static __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()       (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 */
56static 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 */
65static 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 */
73static 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_set atomic_set
103
104/* 019 */
105#define md_lock_kernel lock_kernel
106#define md_unlock_kernel unlock_kernel
107
108/* 020 */
109
110#include <linux/init.h>
111
112#define md__init __init
113#define md__initdata __initdata
114#define md__initfunc(__arginit) __initfunc(__arginit)
115
116/* 021 */
117
118
119/* 022 */
120
121#define md_list_head list_head
122#define MD_LIST_HEAD(name) LIST_HEAD(name)
123#define MD_INIT_LIST_HEAD(ptr) INIT_LIST_HEAD(ptr)
124#define md_list_add list_add
125#define md_list_del list_del
126#define md_list_empty list_empty
127
128#define md_list_entry(ptr, type, member) list_entry(ptr, type, member)
129
130/* 023 */
131
132#define md_schedule_timeout schedule_timeout
133
134/* 024 */
135#define md_need_resched(tsk) ((tsk)->need_resched)
136
137/* 025 */
138#define md_spinlock_t spinlock_t
139#define MD_SPIN_LOCK_UNLOCKED SPIN_LOCK_UNLOCKED
140
141#define md_spin_lock spin_lock
142#define md_spin_unlock spin_unlock
143#define md_spin_lock_irq spin_lock_irq
144#define md_spin_unlock_irq spin_unlock_irq
145#define md_spin_unlock_irqrestore spin_unlock_irqrestore
146#define md_spin_lock_irqsave spin_lock_irqsave
147
148/* 026 */
149typedef wait_queue_head_t md_wait_queue_head_t;
150#define MD_DECLARE_WAITQUEUE(w,t) DECLARE_WAITQUEUE((w),(t))
151#define MD_DECLARE_WAIT_QUEUE_HEAD(x) DECLARE_WAIT_QUEUE_HEAD(x)
152#define md_init_waitqueue_head init_waitqueue_head
153
154/* END */
155
156#endif
157
158