sol_ofs_debug_util.c revision c39526b769298791ff5b0b6c5e761f49aabaeb4e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* This file is more or less the same as the Solaris IBTL debug
* implementation. The debug functions and conf variables are
* similar. One significant change is :
* sol_ofs_supress_above_l2
* above level 2.
*/
#define SOL_OFS_PRINT_BUF_LEN 4096
#define SOL_OFS_DEBUG_BUF_SIZE 0x10000
#define SOL_OFS_DEBUG_EXTRA_SIZE 8
#define SOL_OFS_LOG_L5 5
#define SOL_OFS_LOG_L4 4
#define SOL_OFS_LOG_L3 3
#define SOL_OFS_LOG_L2 2
#define SOL_OFS_LOG_L1 1
#define SOL_OFS_LOG_L0 0
static kmutex_t sol_ofs_debug_mutex;
static char sol_ofs_print_buf[SOL_OFS_PRINT_BUF_LEN];
static char *sol_ofs_debug_sptr = NULL;
static char *sol_ofs_debug_eptr = NULL;
char *sol_ofs_debug_buf = NULL;
int sol_ofs_clear_debug_buf_flag = 0;
int sol_ofs_suppress_dprintf = 0;
int sol_ofs_buffer_dprintf = 1;
int sol_ofs_supress_above_l2 = 1;
/* sol_ofs module (except rdmacm and kverbs) */
int sol_ofs_module_errlevel = 2;
/* Global error levels for all OF related modules */
int sol_of_errlevel = 2;
static void
{
if (sol_ofs_debug_buf) {
}
}
/*
* sol_ofs_dprintf_init() and sol_ofs_dprintf_fini() must be called
* from the _init of the sol_ofs module.
*/
void
{
char *dbg_buf;
#ifdef DEBUG
"setting to 0x%x", sol_ofs_debug_buf_size,
#endif
}
}
void
{
char *dbg_buf;
}
static void
{
char *msg_ptr;
/* if not using logging scheme; quit */
return;
}
/* if level doesn't match, we are done */
if (level > SOL_OFS_LOG_L5) {
return;
}
/* If user requests to clear debug buffer, go ahead */
if (sol_ofs_clear_debug_buf_flag) {
}
/* Skip printing to buffer, if too small */
if (sol_ofs_debug_buf_size <= 0) {
}
/* Put label and debug info into buffer */
"%s:\t", label);
/* Stuff into debug buffer */
if (sol_ofs_buffer_dprintf) {
/*
* overwrite >>>> that might be over the end of the
* buffer.
*/
*sol_ofs_debug_sptr = '\0';
} else {
}
}
/*
* L5-L2 message may go to the sol_ofs_debug_buf
* L1 messages will go to the log buf in non-debug kernels and
* to console and log buf in debug kernels
* L0 messages are warnings and will go to console and log buf
*/
switch (level) {
case SOL_OFS_LOG_L5:
case SOL_OFS_LOG_L4:
case SOL_OFS_LOG_L3:
case SOL_OFS_LOG_L2:
if (!sol_ofs_buffer_dprintf) {
}
break;
case SOL_OFS_LOG_L1 :
#ifdef DEBUG
#else
if (!sol_ofs_buffer_dprintf) {
}
#endif
break;
case SOL_OFS_LOG_L0 :
/* Strip the "\n" added earlier */
}
}
break;
}
}
/* Check individual error levels */
#define SOL_OFS_CHECK_ERR_LEVEL(level) \
if (sol_ucma_errlevel < level) \
return; \
if (sol_rdmacm_errlevel < level) \
return; \
if (sol_uverbs_errlevel < level) \
return; \
if (sol_umad_errlevel < level) \
return; \
if (sol_ofs_module_errlevel < level) \
return; \
if (sol_kverbs_errlevel < level) \
return; \
} else if (sol_of_errlevel < level) \
return;
void
{
return;
}
void
{
return;
}
void
{
return;
}
void
{
}
void
{
}
void
{
if (sol_of_errlevel < SOL_OFS_LOG_L0)
return;
}