2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice unmodified, this list of conditions, and the following
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef _LINUX_KERNEL_H_
29 #define _LINUX_KERNEL_H_
31 #include <sys/systm.h>
32 #include <sys/param.h>
33 #include <sys/libkern.h>
37 #include <linux/bitops.h>
38 #include <linux/compiler.h>
39 #include <linux/errno.h>
40 #include <linux/stddef.h>
41 #include <linux/kthread.h>
42 #include <linux/types.h>
43 #include <linux/jiffies.h>
44 #include <linux/wait.h>
46 #include <linux/notifier.h>
47 #include <linux/log2.h>
48 #include <asm/byteorder.h>
50 #define KERN_EMERG "<0>"
51 #define KERN_ALERT "<1>"
52 #define KERN_CRIT "<2>"
53 #define KERN_ERR "<3>"
54 #define KERN_WARNING "<4>"
55 #define KERN_NOTICE "<5>"
56 #define KERN_INFO "<6>"
57 #define KERN_DEBUG "<7>"
59 #define BUG() panic("BUG")
60 #define BUG_ON(condition) do { if (condition) BUG(); } while(0)
61 #define WARN_ON BUG_ON
64 #define ALIGN(x, y) roundup2((x), (y))
65 #define DIV_ROUND_UP howmany
67 #define printk(X...) printf(X)
68 #define pr_debug(fmt, ...) printk(KERN_DEBUG # fmt, ##__VA_ARGS__)
69 #define udelay(t) DELAY(t)
71 #define container_of(ptr, type, member) \
73 __typeof(((type *)0)->member) *_p = (ptr); \
74 (type *)((char *)_p - offsetof(type, member)); \
77 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
79 #define simple_strtoul strtoul
81 #define min(x, y) (x < y ? x : y)
82 #define max(x, y) (x > y ? x : y)
83 #define min_t(type, _x, _y) (type)(_x) < (type)(_y) ? (type)(_x) : (_y)
84 #define max_t(type, _x, _y) (type)(_x) > (type)(_y) ? (type)(_x) : (_y)
86 #define num_possible_cpus() mp_ncpus
88 #endif /* _LINUX_KERNEL_H_ */