ia64/xen-unstable

view unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @ 16242:3d97c1c1f7c8

pv-on-hvm: fixes for unmodified drivers build and modern Linux

- The adjustments to README and overrides.mk are generic.
- The removal of explicit linux/config.h inclusion should also not
cause any issues.
- The introduction of irq_handler_t should eliminiate warnings on
2.6.19+ kernels (I didn't check they're there, but since the
request_irq prototype changed, I'm sure there's at least
one. However, as a result changes to the Linux tree are expected to
be required.
- The change setup_xen_features -> xen_setup_features follows the
naming in mainline 2.6.23 but would apparently also require changes
to the Linux tree.
- The changes SA_* -> IRQF_ and pci_module_init ->
pci_register_driver should also not cause issues.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir@xensource.com>
date Thu Oct 25 15:54:19 2007 +0100 (2007-10-25)
parents fba9884685fb
children 931e4b987257
line source
1 #ifndef COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H
2 #define COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H
4 #include <linux/version.h>
5 #include <linux/spinlock.h>
6 #include <asm/maddr.h>
8 #if defined(__LINUX_COMPILER_H) && !defined(__always_inline)
9 #define __always_inline inline
10 #endif
12 #if defined(__LINUX_SPINLOCK_H) && !defined(DEFINE_SPINLOCK)
13 #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
14 #endif
16 #if defined(_LINUX_INIT_H) && !defined(__init)
17 #define __init
18 #endif
20 #if defined(__LINUX_CACHE_H) && !defined(__read_mostly)
21 #define __read_mostly
22 #endif
24 #if defined(_LINUX_SKBUFF_H) && !defined(NET_IP_ALIGN)
25 #define NET_IP_ALIGN 0
26 #endif
28 #if defined(_LINUX_SKBUFF_H) && !defined(CHECKSUM_HW)
29 #define CHECKSUM_HW CHECKSUM_PARTIAL
30 #endif
32 #if defined(_LINUX_ERR_H) && !defined(IS_ERR_VALUE)
33 #define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)
34 #endif
36 #if defined(_ASM_IA64_PGTABLE_H) && !defined(_PGTABLE_NOPUD_H)
37 #include <asm-generic/pgtable-nopud.h>
38 #endif
40 /* Some kernels have this typedef backported so we cannot reliably
41 * detect based on version number, hence we forcibly #define it.
42 */
43 #if defined(__LINUX_TYPES_H) || defined(__LINUX_GFP_H) || defined(_LINUX_KERNEL_H)
44 #define gfp_t unsigned
45 #endif
47 #if defined (_LINUX_NOTIFIER_H) && !defined ATOMIC_NOTIFIER_HEAD
48 #define ATOMIC_NOTIFIER_HEAD(name) struct notifier_block *name
49 #define atomic_notifier_chain_register(chain,nb) notifier_chain_register(chain,nb)
50 #define atomic_notifier_chain_unregister(chain,nb) notifier_chain_unregister(chain,nb)
51 #define atomic_notifier_call_chain(chain,val,v) notifier_call_chain(chain,val,v)
52 #endif
54 #if defined(_LINUX_MM_H) && defined set_page_count
55 #define init_page_count(page) set_page_count(page, 1)
56 #endif
58 #if defined(__LINUX_GFP_H) && !defined __GFP_NOMEMALLOC
59 #define __GFP_NOMEMALLOC 0
60 #endif
62 #if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
63 #define nonseekable_open(inode, filp) /* Nothing to do */
64 #endif
66 #if defined(_LINUX_MM_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
67 unsigned long vmalloc_to_pfn(void *addr);
68 #endif
70 #if defined(__LINUX_COMPLETION_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
71 unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout);
72 #endif
74 #if defined(_LINUX_SCHED_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
75 signed long schedule_timeout_interruptible(signed long timeout);
76 #endif
78 #if defined(_LINUX_SLAB_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
79 void *kzalloc(size_t size, int flags);
80 #endif
82 #if defined(_LINUX_BLKDEV_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
83 #define end_that_request_last(req, uptodate) end_that_request_last(req)
84 #endif
86 #if defined(_LINUX_CAPABILITY_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
87 #define capable(cap) (1)
88 #endif
90 #if defined(_LINUX_KERNEL_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
91 extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
92 __attribute__ ((format (printf, 2, 3)));
93 #endif
95 #if defined(_LINUX_SYSRQ_H) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
96 #define handle_sysrq(x,y,z) handle_sysrq(x,y)
97 #endif
99 #if defined(_PAGE_PRESENT) && !defined(_PAGE_NX)
100 #define _PAGE_NX 0
101 /*
102 * This variable at present is referenced by netfront, but only in code that
103 * is dead when running in hvm guests. To detect potential active uses of it
104 * in the future, don't try to supply a 'valid' value here, so that any
105 * mappings created with it will fault when accessed.
106 */
107 #define __supported_pte_mask ((maddr_t)0)
108 #endif
110 #if defined(_LINUX_NETDEVICE_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
111 #define netif_tx_lock_bh(dev) spin_lock_bh(&(dev)->xmit_lock)
112 #define netif_tx_unlock_bh(dev) spin_unlock_bh(&(dev)->xmit_lock)
113 #endif
115 #if defined(__LINUX_SEQLOCK_H) && !defined(DEFINE_SEQLOCK)
116 #define DEFINE_SEQLOCK(x) seqlock_t x = SEQLOCK_UNLOCKED
117 #endif
119 /* Bug in RHEL4-U3: rw_lock_t is mistakenly defined in DEFINE_RWLOCK() macro */
120 #if defined(__LINUX_SPINLOCK_H) && defined(DEFINE_RWLOCK)
121 #define rw_lock_t rwlock_t
122 #endif
124 #if defined(__LINUX_SPINLOCK_H) && !defined(DEFINE_RWLOCK)
125 #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
126 #endif
128 #if defined(_LINUX_INTERRUPT_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
129 typedef irqreturn_t (*irq_handler_t)(int, void *, struct pt_regs *);
130 #endif
132 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
133 #define setup_xen_features xen_setup_features
134 #endif
136 #endif