1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
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 <libcfs/libcfs.h> instead
45 #error This include is only for kernel use.
48 #ifdef HAVE_ASM_TYPES_H
49 #include <asm/types.h>
53 #include <libcfs/linux/linux-time.h>
54 #include <libcfs/linux/linux-mem.h>
55 #include <libcfs/linux/linux-prim.h>
56 #include <libcfs/linux/linux-lock.h>
57 #include <libcfs/linux/linux-fs.h>
58 #include <libcfs/linux/linux-tcpip.h>
59 #include <libcfs/linux/kp30.h>
61 #include <linux/types.h>
62 #include <asm/timex.h>
63 #include <linux/sched.h> /* THREAD_SIZE */
65 #define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5)
67 #if !defined(__x86_64__)
69 # define CDEBUG_STACK() (THREAD_SIZE - \
70 ((unsigned long)__builtin_dwarf_cfa() & \
73 # define CDEBUG_STACK() (THREAD_SIZE - \
74 ((unsigned long)__builtin_frame_address(0) & \
76 # endif /* __ia64__ */
78 #define __CHECK_STACK(file, func, line) \
80 unsigned long _stack = CDEBUG_STACK(); \
82 if (_stack > 3*THREAD_SIZE/4 && _stack > libcfs_stack) { \
83 libcfs_stack = _stack; \
84 libcfs_debug_msg(NULL, DEBUG_SUBSYSTEM, D_WARNING, \
86 "maximum lustre stack %lu\n", _stack); \
90 #define CHECK_STACK() __CHECK_STACK(__FILE__, __func__, __LINE__)
91 #else /* __x86_64__ */
92 #define CHECK_STACK() do { } while(0)
93 #define CDEBUG_STACK() (0L)
94 #endif /* __x86_64__ */
97 #define LUSTRE_LNET_PID 12345
99 #define ENTRY_NESTING_SUPPORT (1)
100 #define ENTRY_NESTING do {;} while (0)
101 #define EXIT_NESTING do {;} while (0)
102 #define __current_nesting_level() (0)
105 * Platform specific declarations for cfs_curproc API (libcfs/curproc.h)
107 * Implementation is in linux-curproc.c
109 #define CFS_CURPROC_COMM_MAX (sizeof ((struct task_struct *)0)->comm)
111 #include <linux/capability.h>
112 typedef kernel_cap_t cfs_kernel_cap_t;
115 * No stack-back-tracing in Linux for now.
117 struct cfs_stack_trace {
120 #ifndef WITH_WATCHDOG
121 #define WITH_WATCHDOG
124 #endif /* _LINUX_LIBCFS_H */