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 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> 49 #include <linux/fs.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> 57 #include <linux/mm.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> 78 #include <net/sock.h> 79 #include <linux/atomic.h> 80 #include <asm/div64.h> 81 #include <linux/timex.h> 82 #include <linux/uaccess.h> 83 #include <stdarg.h> 84 #include "linux-cpu.h" 85 #include "linux-time.h" 86 #include "linux-mem.h" 87 88 #define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5) 89 90 #if !defined(__x86_64__) 91 # ifdef __ia64__ 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__ */ 117 #define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0) 118 #define CDEBUG_STACK() (0L) 119 #endif /* __x86_64__ */ 120 121 /* initial pid */ 122 #define LUSTRE_LNET_PID 12345 123 124 #define __current_nesting_level() (0) 125 126 /** 127 * Platform specific declarations for cfs_curproc API (libcfs/curproc.h) 128 * 129 * Implementation is in linux-curproc.c 130 */ 131 #define CFS_CURPROC_COMM_MAX (sizeof((struct task_struct *)0)->comm) 132 133 #include <linux/capability.h> 134 135 /* long integer with size equal to pointer */ 136 typedef unsigned long ulong_ptr_t; 137 typedef long long_ptr_t; 138 139 #ifndef WITH_WATCHDOG 140 #define WITH_WATCHDOG 141 #endif 142 143 #endif /* _LINUX_LIBCFS_H */ 144