X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Fust%2Fkernelcompat.h;h=1b9058dc2f54ffdbf6a8bdcddf6dcdb22258f115;hb=051d2184d15f5c4a69a4d2e5b5306e69ab03889b;hp=4b43b7e3de02b03ab61156e06719b4ffe9600531;hpb=e17571a59eef2b054c7432f6cba10c2cb467a182;p=ust.git diff --git a/include/ust/kernelcompat.h b/include/ust/kernelcompat.h index 4b43b7e..1b9058d 100644 --- a/include/ust/kernelcompat.h +++ b/include/ust/kernelcompat.h @@ -1,10 +1,25 @@ +/* Copyright (C) 2009 Pierre-Marc Fournier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #ifndef KERNELCOMPAT_H #define KERNELCOMPAT_H -#include - -#include -#include +#include +#include /* FIXME: libkcompat must not define arch-specific local ops, as ust *must* * fallback to the normal atomic ops. Fix things so we don't add them and @@ -15,17 +30,7 @@ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) -#define KERN_DEBUG "" -#define KERN_NOTICE "" -#define KERN_INFO "" -#define KERN_ERR "" -#define KERN_ALERT "" -#define KERN_WARNING "" - -#define WARN_ON_ONCE(msg) WARN_ON(msg) - /* ERROR OPS */ - #define MAX_ERRNO 4095 #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) @@ -73,23 +78,16 @@ static inline long IS_ERR(const void *ptr) /* MALLOCATION */ -#include - -#define kmalloc(s, t) malloc(s) -#define kzalloc(s, t) zmalloc(s) -#define kfree(p) free((void *)p) -#define kstrdup(s, t) strdup(s) - #define zmalloc(s) calloc(1, s) -#define GFP_KERNEL - /* ATTRIBUTES */ +/* FIXME: define this */ #define ____cacheline_aligned /* MATH */ +#include static inline unsigned int hweight32(unsigned int w) { unsigned int res = w - ((w >> 1) & 0x55555555); @@ -99,22 +97,6 @@ static inline unsigned int hweight32(unsigned int w) return (res + (res >> 16)) & 0x000000FF; } -static inline int fls(int x) -{ - int r; -//ust// #ifdef CONFIG_X86_CMOV - asm("bsrl %1,%0\n\t" - "cmovzl %2,%0" - : "=&r" (r) : "rm" (x), "rm" (-1)); -//ust// #else -//ust// asm("bsrl %1,%0\n\t" -//ust// "jnz 1f\n\t" -//ust// "movl $-1,%0\n" -//ust// "1:" : "=r" (r) : "rm" (x)); -//ust// #endif - return r + 1; -} - static __inline__ int get_count_order(unsigned int count) { int order; @@ -175,6 +157,8 @@ static inline u64 trace_clock_read64(void) } #endif +#include + static inline u64 trace_clock_read64(void) { struct timeval tv; @@ -198,9 +182,4 @@ static inline u32 trace_clock_freq_scale(void) return 1; } - -/* PERCPU */ - -#define __get_cpu_var(x) x - #endif /* KERNELCOMPAT_H */