X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=libcfs%2Finclude%2Flibcfs%2Flinux%2Flibcfs.h;h=71a7718e347b9b86d05bc1d0865f701474fd99d7;hb=561bd1db8620a3166100b95f25cf10f1b0211e70;hp=e1a0502278075ca30ca4e7eb65b1ec6cada42434;hpb=f4c694e6ee47769f1c41c70650683a7d034d024e;p=fs%2Flustre-release.git diff --git a/libcfs/include/libcfs/linux/libcfs.h b/libcfs/include/libcfs/linux/libcfs.h index e1a0502..71a7718 100644 --- a/libcfs/include/libcfs/linux/libcfs.h +++ b/libcfs/include/libcfs/linux/libcfs.h @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,8 +24,10 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, 2014, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -47,12 +47,10 @@ #include +#include #include #include -#include -#include #include -#include #include #ifdef HAVE_ASM_TYPES_H @@ -61,8 +59,9 @@ #include #include #include /* THREAD_SIZE */ - -#define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5) +#include +#include +#include #if !defined(__x86_64__) # ifdef __ia64__ @@ -75,32 +74,26 @@ (THREAD_SIZE - 1))) # endif /* __ia64__ */ -#define __CHECK_STACK(file, func, line) \ +#define __CHECK_STACK(msgdata, mask, cdls) \ do { \ - unsigned long _stack = CDEBUG_STACK(); \ - \ - if (_stack > 3*THREAD_SIZE/4 && _stack > libcfs_stack) { \ - libcfs_stack = _stack; \ - libcfs_debug_msg(NULL, DEBUG_SUBSYSTEM, D_WARNING, \ - file, func, line, \ - "maximum lustre stack %lu\n", _stack); \ + if (unlikely(CDEBUG_STACK() > libcfs_stack)) { \ + LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL); \ + libcfs_stack = CDEBUG_STACK(); \ + libcfs_debug_msg(msgdata, \ + "maximum lustre stack %lu\n", \ + CDEBUG_STACK()); \ + (msgdata)->msg_mask = mask; \ + (msgdata)->msg_cdls = cdls; \ + dump_stack(); \ /*panic("LBUG");*/ \ } \ } while (0) -#define CHECK_STACK() __CHECK_STACK(__FILE__, __func__, __LINE__) +#define CFS_CHECK_STACK(msgdata, mask, cdls) __CHECK_STACK(msgdata, mask, cdls) #else /* __x86_64__ */ -#define CHECK_STACK() do { } while(0) +#define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while(0) #define CDEBUG_STACK() (0L) #endif /* __x86_64__ */ -/* initial pid */ -#define LUSTRE_LNET_PID 12345 - -#define ENTRY_NESTING_SUPPORT (1) -#define ENTRY_NESTING do {;} while (0) -#define EXIT_NESTING do {;} while (0) -#define __current_nesting_level() (0) - /** * Platform specific declarations for cfs_curproc API (libcfs/curproc.h) * @@ -108,21 +101,35 @@ do { \ */ #define CFS_CURPROC_COMM_MAX (sizeof ((struct task_struct *)0)->comm) -#include -typedef kernel_cap_t cfs_kernel_cap_t; +/* helper for sysctl handlers */ +int lprocfs_call_handler(void *data, int write, loff_t *ppos, + void __user *buffer, size_t *lenp, + int (*handler)(void *data, int write, + loff_t pos, void __user *buffer, int len)); -/* - * No stack-back-tracing in Linux for now. - */ -struct cfs_stack_trace { -}; +#ifndef HAVE_KSTRTOUL +static inline int kstrtoul(const char *s, unsigned int base, unsigned long *res) +{ + char *end = (char *)s; -/* long integer with size equal to pointer */ -typedef unsigned long ulong_ptr_t; -typedef long long_ptr_t; + *res = simple_strtoul(s, &end, base); + if (end - s == 0) + return -EINVAL; + return 0; +} +#endif /* !HAVE_KSTRTOUL */ #ifndef WITH_WATCHDOG #define WITH_WATCHDOG #endif +/* + * Macros to access common characteristics of "current" UNIX process. + */ +#define current_pid() (current->pid) +#define current_comm() (current->comm) + +/* check if task is running in compat mode.*/ +int current_is_32bit(void); + #endif /* _LINUX_LIBCFS_H */