diff options
author | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2014-02-12 10:12:59 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-02-12 22:31:02 +0100 |
commit | 83bf46f4066e3d5e838a32357c201de9bd6ecdfd (patch) | |
tree | 65f491f7661bd533398625e015f2b5e5bff3badf /src/monitor/monitor_sbus.c | |
parent | 45a1d9d597df977354428440aeff11c6a0a947fe (diff) | |
download | sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.gz sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.xz sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.zip |
Update DEBUG* invocations to use new levels
Use a script to update DEBUG* macro invocations, which use literal
numbers for levels, to use bitmask macros instead:
grep -rl --include '*.[hc]' DEBUG . |
while read f; do
mv "$f"{,.orig}
perl -e 'use strict;
use File::Slurp;
my @map=qw"
SSSDBG_FATAL_FAILURE
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
";
my $text=read_file(\*STDIN);
my $repl;
$text=~s/
^
(
.*
\b
(DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM)
\s*
\(\s*
)(
[0-9]
)(
\s*,
)
(
\s*
)
(
.*
)
$
/
$repl = $1.$map[$3].$4.$5.$6,
length($repl) <= 80
? $repl
: $1.$map[$3].$4."\n".(" " x length($1)).$6
/xmge;
print $text;
' < "$f.orig" > "$f"
rm "$f.orig"
done
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/monitor/monitor_sbus.c')
-rw-r--r-- | src/monitor/monitor_sbus.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/monitor/monitor_sbus.c b/src/monitor/monitor_sbus.c index d94116ef4..4b0e221e8 100644 --- a/src/monitor/monitor_sbus.c +++ b/src/monitor/monitor_sbus.c @@ -61,7 +61,8 @@ static void id_callback(DBusPendingCall *pending, void *ptr) * until reply is valid or timeout has occurred. If reply is NULL * here, something is seriously wrong and we should bail out. */ - DEBUG(0, "Severe error. A reply callback was called but no" + DEBUG(SSSDBG_FATAL_FAILURE, + "Severe error. A reply callback was called but no" " reply was received and no timeout occurred\n"); /* FIXME: Destroy this connection ? */ @@ -75,18 +76,19 @@ static void id_callback(DBusPendingCall *pending, void *ptr) DBUS_TYPE_UINT16, &mon_ver, DBUS_TYPE_INVALID); if (!ret) { - DEBUG(1, "Failed to parse message\n"); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to parse message\n"); if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); /* FIXME: Destroy this connection ? */ goto done; } - DEBUG(4, "Got id ack and version (%d) from Monitor\n", mon_ver); + DEBUG(SSSDBG_CONF_SETTINGS, + "Got id ack and version (%d) from Monitor\n", mon_ver); break; case DBUS_MESSAGE_TYPE_ERROR: - DEBUG(0,"The Monitor returned an error [%s]\n", + DEBUG(SSSDBG_FATAL_FAILURE,"The Monitor returned an error [%s]\n", dbus_message_get_error_name(reply)); /* Falling through to default intentionally*/ default: @@ -120,18 +122,18 @@ int monitor_common_send_id(struct sbus_connection *conn, MON_SRV_INTERFACE, MON_SRV_METHOD_REGISTER); if (msg == NULL) { - DEBUG(0, "Out of memory?!\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory?!\n"); return ENOMEM; } - DEBUG(4, "Sending ID: (%s,%d)\n", name, version); + DEBUG(SSSDBG_CONF_SETTINGS, "Sending ID: (%s,%d)\n", name, version); ret = dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT16, &version, DBUS_TYPE_INVALID); if (!ret) { - DEBUG(1, "Failed to build message\n"); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to build message\n"); return EIO; } @@ -197,14 +199,15 @@ errno_t monitor_common_rotate_logs(struct confdb_ctx *confdb, old_debug_level, &debug_level); if (ret != EOK) { - DEBUG(0, "Error reading from confdb (%d) [%s]\n", + DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) [%s]\n", ret, strerror(ret)); /* Try to proceed with the old value */ debug_level = old_debug_level; } if (debug_level != old_debug_level) { - DEBUG(0, "Debug level changed to %#.4x\n", debug_level); + DEBUG(SSSDBG_FATAL_FAILURE, + "Debug level changed to %#.4x\n", debug_level); debug_level = debug_convert_old_level(debug_level); } @@ -226,7 +229,7 @@ errno_t sss_monitor_init(TALLOC_CTX *mem_ctx, /* Set up SBUS connection to the monitor */ ret = monitor_get_sbus_address(NULL, &sbus_address); if (ret != EOK) { - DEBUG(0, "Could not locate monitor address.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Could not locate monitor address.\n"); return ret; } @@ -234,7 +237,7 @@ errno_t sss_monitor_init(TALLOC_CTX *mem_ctx, intf, &conn, NULL, pvt); if (ret != EOK) { - DEBUG(0, "Failed to connect to monitor services.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Failed to connect to monitor services.\n"); talloc_free(sbus_address); return ret; } @@ -243,7 +246,7 @@ errno_t sss_monitor_init(TALLOC_CTX *mem_ctx, /* Identify ourselves to the monitor */ ret = monitor_common_send_id(conn, svc_name, svc_version); if (ret != EOK) { - DEBUG(0, "Failed to identify to the monitor!\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Failed to identify to the monitor!\n"); return ret; } |