Fix tools compliation described in ticket #1934

Change compat.h to never use KERNEL_VERSION in userspace code.  Move it
to the block only used by the kernel code.  While at that, move KASSERT
to the same block.


git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3706 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
proski 2008-06-06 05:38:29 +00:00
parent a5680de2b6
commit 78ddabe0b4
1 changed files with 21 additions and 23 deletions

View File

@ -58,20 +58,6 @@
#define __force
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
typedef int gfp_t;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)
static inline void *kzalloc(size_t size, gfp_t flags)
{
void *p = kmalloc(size, flags);
if (likely(p != NULL))
memset(p, 0, size);
return p;
}
#endif
#ifndef container_of
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
@ -115,15 +101,6 @@ static inline void *kzalloc(size_t size, gfp_t flags)
#define __offsetof(t,m) offsetof(t,m)
#ifdef __KERNEL__
#define KASSERT(exp, msg) do { \
if (unlikely(!(exp))) { \
printk msg; \
BUG(); \
} \
} while (0)
#endif /* __KERNEL__ */
/*
* NetBSD/FreeBSD defines for file version.
*/
@ -135,6 +112,27 @@ static inline void *kzalloc(size_t size, gfp_t flags)
*/
#ifdef __KERNEL__
#define KASSERT(exp, msg) do { \
if (unlikely(!(exp))) { \
printk msg; \
BUG(); \
} \
} while (0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
typedef int gfp_t;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)
static inline void *kzalloc(size_t size, gfp_t flags)
{
void *p = kmalloc(size, flags);
if (likely(p != NULL))
memset(p, 0, size);
return p;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
#define ATH_REGISTER_SYSCTL_TABLE(t) register_sysctl_table(t, 1)
#else