Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 1 | /* |
| 2 | * GPL HEADER START |
| 3 | * |
| 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 5 | * |
| 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. |
| 9 | * |
| 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). |
| 15 | * |
| 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 |
| 19 | * |
| 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 |
| 22 | * have any questions. |
| 23 | * |
| 24 | * GPL HEADER END |
| 25 | */ |
| 26 | /* |
| 27 | * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
| 28 | * Use is subject to license terms. |
| 29 | * |
| 30 | * Copyright (c) 2012, Intel Corporation. |
| 31 | */ |
| 32 | /* |
| 33 | * This file is part of Lustre, http://www.lustre.org/ |
| 34 | * Lustre is a trademark of Sun Microsystems, Inc. |
| 35 | */ |
| 36 | |
| 37 | #ifndef __LIBCFS_LINUX_LIBCFS_H__ |
| 38 | #define __LIBCFS_LINUX_LIBCFS_H__ |
| 39 | |
| 40 | #ifndef __LIBCFS_LIBCFS_H__ |
| 41 | #error Do not #include this file directly. #include <linux/libcfs/libcfs.h> instead |
| 42 | #endif |
| 43 | |
Greg Kroah-Hartman | d2bc118 | 2014-07-11 23:15:15 -0700 | [diff] [blame] | 44 | #include <linux/bitops.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 45 | #include <linux/compiler.h> |
| 46 | #include <linux/ctype.h> |
| 47 | #include <linux/errno.h> |
| 48 | #include <linux/file.h> |
| 49 | #include <linux/fs.h> |
| 50 | #include <linux/highmem.h> |
| 51 | #include <linux/interrupt.h> |
| 52 | #include <linux/kallsyms.h> |
Greg Kroah-Hartman | fa8d5b4 | 2014-07-12 18:17:20 -0700 | [diff] [blame] | 53 | #include <linux/kernel.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 54 | #include <linux/kmod.h> |
Greg Kroah-Hartman | fa8d5b4 | 2014-07-12 18:17:20 -0700 | [diff] [blame] | 55 | #include <linux/kthread.h> |
| 56 | #include <linux/miscdevice.h> |
| 57 | #include <linux/mm.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 58 | #include <linux/mm_inline.h> |
Greg Kroah-Hartman | fa8d5b4 | 2014-07-12 18:17:20 -0700 | [diff] [blame] | 59 | #include <linux/module.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 60 | #include <linux/moduleparam.h> |
Greg Kroah-Hartman | 6de9710 | 2014-07-11 23:28:12 -0700 | [diff] [blame] | 61 | #include <linux/mutex.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 62 | #include <linux/notifier.h> |
James Simmons | 899e1a3 | 2016-03-31 10:18:40 -0400 | [diff] [blame] | 63 | #include <linux/pagemap.h> |
Greg Kroah-Hartman | fa8d5b4 | 2014-07-12 18:17:20 -0700 | [diff] [blame] | 64 | #include <linux/random.h> |
| 65 | #include <linux/rbtree.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 66 | #include <linux/rwsem.h> |
| 67 | #include <linux/scatterlist.h> |
Greg Kroah-Hartman | fa8d5b4 | 2014-07-12 18:17:20 -0700 | [diff] [blame] | 68 | #include <linux/sched.h> |
| 69 | #include <linux/signal.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 70 | #include <linux/slab.h> |
| 71 | #include <linux/smp.h> |
| 72 | #include <linux/stat.h> |
| 73 | #include <linux/string.h> |
| 74 | #include <linux/time.h> |
Greg Kroah-Hartman | fa8d5b4 | 2014-07-12 18:17:20 -0700 | [diff] [blame] | 75 | #include <linux/timer.h> |
Greg Kroah-Hartman | 9fc48d0 | 2014-07-11 23:32:19 -0700 | [diff] [blame] | 76 | #include <linux/types.h> |
Greg Kroah-Hartman | 0918cf0 | 2014-07-12 20:32:03 -0700 | [diff] [blame] | 77 | #include <linux/unistd.h> |
| 78 | #include <linux/vmalloc.h> |
Greg Kroah-Hartman | fb4a153 | 2014-07-12 00:01:03 -0700 | [diff] [blame] | 79 | #include <net/sock.h> |
Gulsah Kose | c2ad80e | 2014-09-30 21:59:19 +0300 | [diff] [blame] | 80 | #include <linux/atomic.h> |
Greg Kroah-Hartman | fa8d5b4 | 2014-07-12 18:17:20 -0700 | [diff] [blame] | 81 | #include <asm/div64.h> |
Gulsah Kose | c2ad80e | 2014-09-30 21:59:19 +0300 | [diff] [blame] | 82 | #include <linux/timex.h> |
| 83 | #include <linux/uaccess.h> |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 84 | #include <stdarg.h> |
Greg Kroah-Hartman | 9fdaf8c | 2014-07-11 20:51:16 -0700 | [diff] [blame] | 85 | #include "linux-cpu.h" |
| 86 | #include "linux-time.h" |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 87 | |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 88 | #define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5) |
| 89 | |
| 90 | #if !defined(__x86_64__) |
Greg Kroah-Hartman | a393fd5 | 2014-07-11 22:47:02 -0700 | [diff] [blame] | 91 | # ifdef __ia64__ |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 92 | # define CDEBUG_STACK() (THREAD_SIZE - \ |
| 93 | ((unsigned long)__builtin_dwarf_cfa() & \ |
| 94 | (THREAD_SIZE - 1))) |
| 95 | # else |
| 96 | # define CDEBUG_STACK() (THREAD_SIZE - \ |
| 97 | ((unsigned long)__builtin_frame_address(0) & \ |
| 98 | (THREAD_SIZE - 1))) |
| 99 | # endif /* __ia64__ */ |
| 100 | |
| 101 | #define __CHECK_STACK(msgdata, mask, cdls) \ |
| 102 | do { \ |
| 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", \ |
| 108 | CDEBUG_STACK()); \ |
| 109 | (msgdata)->msg_mask = mask; \ |
| 110 | (msgdata)->msg_cdls = cdls; \ |
| 111 | dump_stack(); \ |
| 112 | /*panic("LBUG");*/ \ |
| 113 | } \ |
| 114 | } while (0) |
| 115 | #define CFS_CHECK_STACK(msgdata, mask, cdls) __CHECK_STACK(msgdata, mask, cdls) |
| 116 | #else /* __x86_64__ */ |
Greg Kroah-Hartman | a393fd5 | 2014-07-11 22:47:02 -0700 | [diff] [blame] | 117 | #define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0) |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 118 | #define CDEBUG_STACK() (0L) |
| 119 | #endif /* __x86_64__ */ |
| 120 | |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 121 | #define __current_nesting_level() (0) |
| 122 | |
| 123 | /** |
| 124 | * Platform specific declarations for cfs_curproc API (libcfs/curproc.h) |
| 125 | * |
| 126 | * Implementation is in linux-curproc.c |
| 127 | */ |
Greg Kroah-Hartman | a393fd5 | 2014-07-11 22:47:02 -0700 | [diff] [blame] | 128 | #define CFS_CURPROC_COMM_MAX (sizeof((struct task_struct *)0)->comm) |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 129 | |
| 130 | #include <linux/capability.h> |
| 131 | |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 132 | /* long integer with size equal to pointer */ |
| 133 | typedef unsigned long ulong_ptr_t; |
| 134 | typedef long long_ptr_t; |
| 135 | |
| 136 | #ifndef WITH_WATCHDOG |
| 137 | #define WITH_WATCHDOG |
| 138 | #endif |
| 139 | |
Peng Tao | d7e09d0 | 2013-05-02 16:46:55 +0800 | [diff] [blame] | 140 | #endif /* _LINUX_LIBCFS_H */ |