#ifdef __KERNEL__
+# include <linux/slab.h>
# define free(x) kfree(x)
#else
# include <stdlib.h>
extern "C" {
#endif
-#ifdef __CYGWIN__
-# include <asm/types.h>
-# include <inttypes.h>
-typedef uint64_t __u64;
-#else
-# include <linux/types.h> /* just for int types */
-#endif
+#include <linux/types.h> /* just for int types */
-#ifndef BUG_ON
+#ifndef __KERNEL__
# include <assert.h>
# define BUG_ON(x) assert(!(x))
#endif
#include "crush.h"
#include "hash.h"
-#include <string.h>
-#include <stdio.h>
+#ifdef __KERNEL__
+# include <linux/string.h>
+# include <linux/slab.h>
+# include <asm/bug.h>
+#else
+# include <string.h>
+# include <stdio.h>
+#endif
/** bucket choose methods **/