4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2012, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #ifndef __LIBCFS_LINUX_LIBCFS_H__
38 #define __LIBCFS_LINUX_LIBCFS_H__
40 #ifndef __LIBCFS_LIBCFS_H__
41 #error Do not #include this file directly. #include <linux/libcfs/libcfs.h> instead
44 #include <linux/bitops.h>
45 #include <linux/compiler.h>
46 #include <linux/ctype.h>
47 #include <linux/errno.h>
48 #include <linux/file.h>
50 #include <linux/highmem.h>
51 #include <linux/interrupt.h>
52 #include <linux/kallsyms.h>
53 #include <linux/kernel.h>
54 #include <linux/kmod.h>
55 #include <linux/kthread.h>
56 #include <linux/miscdevice.h>
58 #include <linux/mm_inline.h>
59 #include <linux/module.h>
60 #include <linux/moduleparam.h>
61 #include <linux/mutex.h>
62 #include <linux/notifier.h>
63 #include <linux/random.h>
64 #include <linux/rbtree.h>
65 #include <linux/rwsem.h>
66 #include <linux/scatterlist.h>
67 #include <linux/sched.h>
68 #include <linux/signal.h>
69 #include <linux/slab.h>
70 #include <linux/smp.h>
71 #include <linux/stat.h>
72 #include <linux/string.h>
73 #include <linux/time.h>
74 #include <linux/timer.h>
75 #include <linux/types.h>
76 #include <linux/unistd.h>
77 #include <linux/vmalloc.h>
79 #include <linux/atomic.h>
80 #include <asm/div64.h>
81 #include <linux/timex.h>
82 #include <linux/uaccess.h>
84 #include "linux-cpu.h"
85 #include "linux-time.h"
86 #include "linux-mem.h"
88 #define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5)
90 #if !defined(__x86_64__)
92 # define CDEBUG_STACK() (THREAD_SIZE - \
93 ((unsigned long)__builtin_dwarf_cfa() & \
96 # define CDEBUG_STACK() (THREAD_SIZE - \
97 ((unsigned long)__builtin_frame_address(0) & \
99 # endif /* __ia64__ */
101 #define __CHECK_STACK(msgdata, mask, cdls) \
103 if (unlikely(CDEBUG_STACK() > libcfs_stack)) { \
104 LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL); \
105 libcfs_stack = CDEBUG_STACK(); \
106 libcfs_debug_msg(msgdata, \
107 "maximum lustre stack %lu\n", \
109 (msgdata)->msg_mask = mask; \
110 (msgdata)->msg_cdls = cdls; \
115 #define CFS_CHECK_STACK(msgdata, mask, cdls) __CHECK_STACK(msgdata, mask, cdls)
116 #else /* __x86_64__ */
117 #define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0)
118 #define CDEBUG_STACK() (0L)
119 #endif /* __x86_64__ */
122 #define LUSTRE_LNET_PID 12345
124 #define __current_nesting_level() (0)
127 * Platform specific declarations for cfs_curproc API (libcfs/curproc.h)
129 * Implementation is in linux-curproc.c
131 #define CFS_CURPROC_COMM_MAX (sizeof((struct task_struct *)0)->comm)
133 #include <linux/capability.h>
135 /* long integer with size equal to pointer */
136 typedef unsigned long ulong_ptr_t;
137 typedef long long_ptr_t;
139 #ifndef WITH_WATCHDOG
140 #define WITH_WATCHDOG
143 #endif /* _LINUX_LIBCFS_H */