![]() |
|
|||
0001 /* 0002 * linux/drivers/scsi/esas2r/esas2r_log.h 0003 * For use with ATTO ExpressSAS R6xx SAS/SATA RAID controllers 0004 * 0005 * Copyright (c) 2001-2013 ATTO Technology, Inc. 0006 * (mailto:linuxdrivers@attotech.com) 0007 * 0008 * This program is free software; you can redistribute it and/or 0009 * modify it under the terms of the GNU General Public License 0010 * as published by the Free Software Foundation; either version 2 0011 * of the License, or (at your option) any later version. 0012 * 0013 * This program is distributed in the hope that it will be useful, 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0016 * GNU General Public License for more details. 0017 * 0018 * NO WARRANTY 0019 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 0020 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 0021 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 0022 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 0023 * solely responsible for determining the appropriateness of using and 0024 * distributing the Program and assumes all risks associated with its 0025 * exercise of rights under this Agreement, including but not limited to 0026 * the risks and costs of program errors, damage to or loss of data, 0027 * programs or equipment, and unavailability or interruption of operations. 0028 * 0029 * DISCLAIMER OF LIABILITY 0030 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 0031 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 0032 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 0033 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 0034 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 0035 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 0036 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 0037 * 0038 * You should have received a copy of the GNU General Public License 0039 * along with this program; if not, write to the Free Software 0040 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 0041 * USA. 0042 */ 0043 0044 #ifndef __esas2r_log_h__ 0045 #define __esas2r_log_h__ 0046 0047 struct device; 0048 0049 enum { 0050 ESAS2R_LOG_NONE = 0, /* no events logged */ 0051 ESAS2R_LOG_CRIT = 1, /* critical events */ 0052 ESAS2R_LOG_WARN = 2, /* warning events */ 0053 ESAS2R_LOG_INFO = 3, /* info events */ 0054 ESAS2R_LOG_DEBG = 4, /* debugging events */ 0055 ESAS2R_LOG_TRCE = 5, /* tracing events */ 0056 0057 #ifdef ESAS2R_TRACE 0058 ESAS2R_LOG_DFLT = ESAS2R_LOG_TRCE 0059 #else 0060 ESAS2R_LOG_DFLT = ESAS2R_LOG_WARN 0061 #endif 0062 }; 0063 0064 __printf(2, 3) int esas2r_log(const long level, const char *format, ...); 0065 __printf(3, 4) int esas2r_log_dev(const long level, 0066 const struct device *dev, 0067 const char *format, 0068 ...); 0069 int esas2r_log_hexdump(const long level, 0070 const void *buf, 0071 size_t len); 0072 0073 /* 0074 * the following macros are provided specifically for debugging and tracing 0075 * messages. esas2r_debug() is provided for generic non-hardware layer 0076 * debugging and tracing events. esas2r_hdebug is provided specifically for 0077 * hardware layer debugging and tracing events. 0078 */ 0079 0080 #ifdef ESAS2R_DEBUG 0081 #define esas2r_debug(f, args ...) esas2r_log(ESAS2R_LOG_DEBG, f, ## args) 0082 #define esas2r_hdebug(f, args ...) esas2r_log(ESAS2R_LOG_DEBG, f, ## args) 0083 #else 0084 #define esas2r_debug(f, args ...) 0085 #define esas2r_hdebug(f, args ...) 0086 #endif /* ESAS2R_DEBUG */ 0087 0088 /* 0089 * the following macros are provided in order to trace the driver and catch 0090 * some more serious bugs. be warned, enabling these macros may *severely* 0091 * impact performance. 0092 */ 0093 0094 #ifdef ESAS2R_TRACE 0095 #define esas2r_bugon() \ 0096 do { \ 0097 esas2r_log(ESAS2R_LOG_TRCE, "esas2r_bugon() called in %s:%d" \ 0098 " - dumping stack and stopping kernel", __func__, \ 0099 __LINE__); \ 0100 dump_stack(); \ 0101 BUG(); \ 0102 } while (0) 0103 0104 #define esas2r_trace_enter() esas2r_log(ESAS2R_LOG_TRCE, "entered %s (%s:%d)", \ 0105 __func__, __FILE__, __LINE__) 0106 #define esas2r_trace_exit() esas2r_log(ESAS2R_LOG_TRCE, "exited %s (%s:%d)", \ 0107 __func__, __FILE__, __LINE__) 0108 #define esas2r_trace(f, args ...) esas2r_log(ESAS2R_LOG_TRCE, "(%s:%s:%d): " \ 0109 f, __func__, __FILE__, __LINE__, \ 0110 ## args) 0111 #else 0112 #define esas2r_bugon() 0113 #define esas2r_trace_enter() 0114 #define esas2r_trace_exit() 0115 #define esas2r_trace(f, args ...) 0116 #endif /* ESAS2R_TRACE */ 0117 0118 #endif /* __esas2r_log_h__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |