| 1 | /* |
| 2 | * kcompat.h |
| 3 | * |
| 4 | * Copyright (C) 2009 - Pierre-Marc Fournier (pierre-marc dot fournier at polymtl dot ca) |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #ifndef KCOMPAT_H |
| 22 | #define KCOMPAT_H |
| 23 | |
| 24 | #define __KERNEL__ |
| 25 | #define _LOOSE_KERNEL_NAMES |
| 26 | |
| 27 | #ifndef CONFIG_SMP |
| 28 | #define CONFIG_SMP 1 /* Needed for urcu, verify it's ok to remove it. */ |
| 29 | #endif |
| 30 | |
| 31 | #include <limits.h> |
| 32 | #include <bits/wordsize.h> |
| 33 | #if __WORDSIZE == 32 |
| 34 | #define LIBKCOMPAT_X86_32 |
| 35 | #elif __WORDSIZE == 64 |
| 36 | #define LIBKCOMPAT_X86_64 |
| 37 | #else |
| 38 | #error "Unsupported" |
| 39 | #endif |
| 40 | |
| 41 | #ifdef LIBKCOMPAT_X86_32 |
| 42 | #define CONFIG_X86_32 |
| 43 | #define CONFIG_32BIT |
| 44 | #endif |
| 45 | |
| 46 | #ifdef LIBKCOMPAT_X86_64 |
| 47 | #define CONFIG_X86_64 |
| 48 | #define CONFIG_64BIT |
| 49 | #endif |
| 50 | |
| 51 | /* Standard libs */ |
| 52 | #include <stdint.h> |
| 53 | #include <stddef.h> |
| 54 | |
| 55 | /* Taken from userspace-rcu */ |
| 56 | #include <urcu/arch.h> |
| 57 | |
| 58 | /* Kernel libs */ |
| 59 | #include <ust/kcompat/compiler.h> |
| 60 | #include <ust/kcompat/types.h> |
| 61 | #include <ust/kcompat/jhash.h> |
| 62 | |
| 63 | #endif /* KCOMPAT_H */ |