1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 
  25 #ifndef _RDSV3_DEBUG_H
  26 #define _RDSV3_DEBUG_H
  27 
  28 #ifdef __cplusplus
  29 extern "C" {
  30 #endif
  31 
  32 #define         LABEL   "RDSV3"
  33 
  34 /*
  35  * warnings, console & syslog buffer.
  36  * For Non recoverable or Major Errors
  37  */
  38 #define RDSV3_LOG_L0    0
  39 
  40 /*
  41  * syslog buffer or RDS trace buffer (console if booted /w debug)
  42  * For additional information on Non recoverable errors and
  43  * warnings/informational message for sys-admin types.
  44  */
  45 #define RDSV3_LOG_L1    1
  46 
  47 /*
  48  * debug only
  49  * for more verbose trace than L1, for e.g. recoverable errors,
  50  * or intersting trace
  51  */
  52 #define RDSV3_LOG_L2    2
  53 
  54 /*
  55  * debug only
  56  * for more verbose trace than L2, for e.g. informational messages
  57  */
  58 #define RDSV3_LOG_L3    3
  59 
  60 /*
  61  * debug only
  62  * for more verbose trace than L3, for e.g. printing function entries...
  63  */
  64 #define RDSV3_LOG_L4    4
  65 
  66 /*
  67  * debug only
  68  * most verbose level. Used only for  excessive trace, for e.g.
  69  * printing structures etc.
  70  */
  71 #define RDSV3_LOG_L5    5
  72 
  73 /*
  74  * debug only
  75  * for messages from softints, taskqs, intr handlers, timeout handlers etc.
  76  */
  77 #define RDSV3_LOG_LINTR 6
  78 
  79 
  80 #ifdef DEBUG
  81 #define RDSV3_DPRINTF_INTR      rdsv3_dprintf_intr
  82 #define RDSV3_DPRINTF5          rdsv3_dprintf5
  83 #define RDSV3_DPRINTF4          rdsv3_dprintf4
  84 #define RDSV3_DPRINTF3          rdsv3_dprintf3
  85 
  86 void rdsv3_dprintf_intr(
  87                 char            *name,
  88                 char            *fmt, ...);
  89 void rdsv3_dprintf5(
  90                 char            *name,
  91                 char            *fmt, ...);
  92 void rdsv3_dprintf4(
  93                 char            *name,
  94                 char            *fmt, ...);
  95 void rdsv3_dprintf3(
  96                 char            *name,
  97                 char            *fmt, ...);
  98 #else
  99 #define RDSV3_DPRINTF_INTR      0 &&
 100 #define RDSV3_DPRINTF5          0 &&
 101 #define RDSV3_DPRINTF4          0 &&
 102 #define RDSV3_DPRINTF3          0 &&
 103 #endif
 104 
 105 #define RDSV3_DPRINTF2          rdsv3_dprintf2
 106 #define RDSV3_DPRINTF1          rdsv3_dprintf1
 107 #define RDSV3_DPRINTF0          rdsv3_dprintf0
 108 
 109 void rdsv3_dprintf2(
 110                 char            *name,
 111                 char            *fmt, ...);
 112 void rdsv3_dprintf1(
 113                 char            *name,
 114                 char            *fmt, ...);
 115 void rdsv3_dprintf0(
 116                 char            *name,
 117                 char            *fmt, ...);
 118 
 119 void rdsv3_trace(
 120                 char            *name,
 121                 uint8_t         lvl,
 122                 char            *fmt, ...);
 123 
 124 void rdsv3_vprintk(
 125                 char            *name,
 126                 uint8_t         lvl,
 127                 const char      *fmt,
 128                 va_list         ap);
 129 
 130 /* defined in rds_debug.c */
 131 void rdsv3_logging_initialization();
 132 void rdsv3_logging_destroy();
 133 int rdsv3_printk_ratelimit(void);
 134 
 135 #ifdef __cplusplus
 136 }
 137 #endif
 138 
 139 #endif  /* _RDSV3_DEBUG_H */