summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2013-12-20 16:51:37 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:31:13 +0100
commit5c233380e1ebf641f6106a34d7b94f9e9a606589 (patch)
tree421a41bd27f02d5cca480c0241f38feddbc7b1d4 /src
parentdfdc99afd56b605632adc265bfb1f55cd52b3dbe (diff)
downloadsssd-5c233380e1ebf641f6106a34d7b94f9e9a606589.tar.gz
sssd-5c233380e1ebf641f6106a34d7b94f9e9a606589.tar.xz
sssd-5c233380e1ebf641f6106a34d7b94f9e9a606589.zip
Remove DEBUG macro support for old debug levels
Remove support for specifying old debug levels to the DEBUG macro: * remove debug_get_level function which was used for conversion, * remove debug_get_level tests, * remove mentions of old/new levels from DEBUG and DEBUG_IS_SET macro descriptions, * rename "newlevel" argument of debug_fn to just "level". Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/providers/data_provider.h2
-rw-r--r--src/providers/proxy/proxy_id.c2
-rw-r--r--src/tests/debug-tests.c66
-rw-r--r--src/util/debug.c32
-rw-r--r--src/util/util.h20
5 files changed, 11 insertions, 111 deletions
diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h
index 55891c9f2..f88637c2d 100644
--- a/src/providers/data_provider.h
+++ b/src/providers/data_provider.h
@@ -165,7 +165,7 @@
/* AUTH related common data and functions */
#define DEBUG_PAM_DATA(level, pd) do { \
- if (DEBUG_IS_SET(debug_get_level(level))) pam_print_data(level, pd); \
+ if (DEBUG_IS_SET(level)) pam_print_data(level, pd); \
} while(0)
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index f78c4c630..d867ec45f 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -498,7 +498,7 @@ done:
/* =Save-group-utilities=================================================*/
#define DEBUG_GR_MEM(level, grp) \
do { \
- if (DEBUG_IS_SET(debug_get_level(level))) { \
+ if (DEBUG_IS_SET(level)) { \
if (!grp->gr_mem || !grp->gr_mem[0]) { \
DEBUG(level, "Group %s has no members!\n", \
grp->gr_name); \
diff --git a/src/tests/debug-tests.c b/src/tests/debug-tests.c
index 0d2fe39fc..cc422382a 100644
--- a/src/tests/debug-tests.c
+++ b/src/tests/debug-tests.c
@@ -115,70 +115,6 @@ START_TEST(test_debug_convert_old_level_new_format)
}
END_TEST
-START_TEST(test_debug_get_level_old_format)
-{
- fail_unless(debug_get_level(0) == SSSDBG_FATAL_FAILURE, "Invalid conversion of 0");
- fail_unless(debug_get_level(1) == SSSDBG_CRIT_FAILURE, "Invalid conversion of 1");
- fail_unless(debug_get_level(2) == SSSDBG_OP_FAILURE, "Invalid conversion of 2");
- fail_unless(debug_get_level(3) == SSSDBG_MINOR_FAILURE, "Invalid conversion of 3");
- fail_unless(debug_get_level(4) == SSSDBG_CONF_SETTINGS, "Invalid conversion of 4");
- fail_unless(debug_get_level(5) == SSSDBG_FUNC_DATA, "Invalid conversion of 5");
- fail_unless(debug_get_level(6) == SSSDBG_TRACE_FUNC, "Invalid conversion of 6");
- fail_unless(debug_get_level(7) == SSSDBG_TRACE_LIBS, "Invalid conversion of 7");
- fail_unless(debug_get_level(8) == SSSDBG_TRACE_INTERNAL, "Invalid conversion of 8");
- fail_unless(debug_get_level(9) == SSSDBG_TRACE_ALL, "Invalid conversion of 9");
-}
-END_TEST
-
-START_TEST(test_debug_get_level_new_format)
-{
- fail_unless(
- debug_get_level(SSSDBG_UNRESOLVED) == SSSDBG_FATAL_FAILURE,
- "Invalid conversion of SSSDBG_UNRESOLVED"
- );
- fail_unless(
- debug_get_level(SSSDBG_FATAL_FAILURE) == SSSDBG_FATAL_FAILURE,
- "Invalid conversion of SSSDBG_FATAL_FAILURE"
- );
- fail_unless(
- debug_get_level(SSSDBG_CRIT_FAILURE) == SSSDBG_CRIT_FAILURE,
- "Invalid conversion of SSSDBG_CRIT_FAILURE"
- );
- fail_unless(
- debug_get_level(SSSDBG_OP_FAILURE) == SSSDBG_OP_FAILURE,
- "Invalid conversion of SSSDBG_OP_FAILURE"
- );
- fail_unless(
- debug_get_level(SSSDBG_MINOR_FAILURE) == SSSDBG_MINOR_FAILURE,
- "Invalid conversion of SSSDBG_MINOR_FAILURE"
- );
- fail_unless(
- debug_get_level(SSSDBG_CONF_SETTINGS) == SSSDBG_CONF_SETTINGS,
- "Invalid conversion of SSSDBG_CONF_SETTINGS"
- );
- fail_unless(
- debug_get_level(SSSDBG_FUNC_DATA) == SSSDBG_FUNC_DATA,
- "Invalid conversion of SSSDBG_FUNC_DATA"
- );
- fail_unless(
- debug_get_level(SSSDBG_TRACE_FUNC) == SSSDBG_TRACE_FUNC,
- "Invalid conversion of SSSDBG_TRACE_FUNC"
- );
- fail_unless(
- debug_get_level(SSSDBG_TRACE_LIBS) == SSSDBG_TRACE_LIBS,
- "Invalid conversion of SSSDBG_TRACE_LIBS"
- );
- fail_unless(
- debug_get_level(SSSDBG_TRACE_INTERNAL) == SSSDBG_TRACE_INTERNAL,
- "Invalid conversion of SSSDBG_TRACE_INTERNAL"
- );
- fail_unless(
- debug_get_level(SSSDBG_TRACE_ALL) == SSSDBG_TRACE_ALL,
- "Invalid conversion of SSSDBG_TRACE_ALL"
- );
-}
-END_TEST
-
int test_helper_debug_check_message(int level)
{
TALLOC_CTX *ctx = talloc_new(NULL);
@@ -723,8 +659,6 @@ Suite *debug_suite(void)
tcase_add_test(tc_debug, test_debug_convert_old_level_old_format);
tcase_add_test(tc_debug, test_debug_convert_old_level_new_format);
- tcase_add_test(tc_debug, test_debug_get_level_old_format);
- tcase_add_test(tc_debug, test_debug_get_level_new_format);
tcase_add_test(tc_debug, test_debug_is_set_single_no_timestamp);
tcase_add_test(tc_debug, test_debug_is_set_single_timestamp);
tcase_add_test(tc_debug, test_debug_is_set_single_timestamp_microseconds);
diff --git a/src/util/debug.c b/src/util/debug.c
index 5d6132b88..6ac916573 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -129,7 +129,7 @@ static void debug_printf(const char *format, ...)
va_end(ap);
}
-void debug_fn(const char *function, int newlevel, const char *format, ...)
+void debug_fn(const char *function, int level, const char *format, ...)
{
va_list ap;
struct timeval tv;
@@ -148,15 +148,15 @@ void debug_fn(const char *function, int newlevel, const char *format, ...)
debug_printf("(%s:%.6ld %d) [%s] [%s] (%#.4x): ",
datetime, tv.tv_usec,
year, debug_prg_name,
- function, newlevel);
+ function, level);
} else {
debug_printf("(%s %d) [%s] [%s] (%#.4x): ",
datetime, year,
- debug_prg_name, function, newlevel);
+ debug_prg_name, function, level);
}
} else {
debug_printf("[%s] [%s] (%#.4x): ",
- debug_prg_name, function, newlevel);
+ debug_prg_name, function, level);
}
va_start(ap, format);
@@ -165,30 +165,6 @@ void debug_fn(const char *function, int newlevel, const char *format, ...)
debug_fflush();
}
-int debug_get_level(int old_level)
-{
- if ((old_level != 0) && !(old_level & 0x000F))
- return old_level;
-
- if ((old_level > 9) || (old_level < 0))
- return SSSDBG_FATAL_FAILURE;
-
- int levels[] = {
- SSSDBG_FATAL_FAILURE, /* 0 */
- SSSDBG_CRIT_FAILURE,
- SSSDBG_OP_FAILURE,
- SSSDBG_MINOR_FAILURE,
- SSSDBG_CONF_SETTINGS,
- SSSDBG_FUNC_DATA,
- SSSDBG_TRACE_FUNC,
- SSSDBG_TRACE_LIBS,
- SSSDBG_TRACE_INTERNAL,
- SSSDBG_TRACE_ALL /* 9 */
- };
-
- return levels[old_level];
-}
-
void ldb_debug_messages(void *context, enum ldb_debug_level level,
const char *fmt, va_list ap)
{
diff --git a/src/util/util.h b/src/util/util.h
index 9cc53f880..14d797480 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -68,9 +68,8 @@ extern int debug_timestamps;
extern int debug_microseconds;
extern int debug_to_file;
extern const char *debug_log_file;
-void debug_fn(const char *function, int newlevel, const char *format, ...)
+void debug_fn(const char *function, int level, const char *format, ...)
SSS_ATTRIBUTE_PRINTF(3, 4);
-int debug_get_level(int old_level);
int debug_convert_old_level(int old_level);
errno_t set_debug_file_from_fd(const int fd);
@@ -113,27 +112,18 @@ errno_t set_debug_file_from_fd(const int fd);
\brief macro to generate debug messages
\param level the debug level, please use one of the SSSDBG_* macros
- Old format:
- - 1 is for critical errors users may find it difficult to understand but
- are still quite clear
- - 2-4 is for stuff developers are interested in in general, but
- shouldn't fill the screen with useless low level verbose stuff
- - 5-6 is for errors you may want to track, but only if you explicitly
- looking for additional clues
- - 7-10 is for informational stuff
-
\param format the debug message format string, should result in a
newline-terminated message
\param ... the debug message format arguments
*/
#define DEBUG(level, format, ...) do { \
- int __debug_macro_newlevel = debug_get_level(level); \
- if (DEBUG_IS_SET(__debug_macro_newlevel)) \
- debug_fn(__FUNCTION__, __debug_macro_newlevel, format, ##__VA_ARGS__); \
+ int __debug_macro_level = level; \
+ if (DEBUG_IS_SET(__debug_macro_level)) \
+ debug_fn(__FUNCTION__, __debug_macro_level, format, ##__VA_ARGS__); \
} while (0)
/** \def DEBUG_IS_SET(level)
- \brief checks whether level (must be in new format) is set in debug_level
+ \brief checks whether level is set in debug_level
\param level the debug level, please use one of the SSSDBG*_ macros
*/