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/sbus/sssd_dbus_connection.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/sbus/sssd_dbus_connection.c')
-rw-r--r-- | src/sbus/sssd_dbus_connection.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/src/sbus/sssd_dbus_connection.c b/src/sbus/sssd_dbus_connection.c index d1b83214a..eb07b8d5b 100644 --- a/src/sbus/sssd_dbus_connection.c +++ b/src/sbus/sssd_dbus_connection.c @@ -58,12 +58,12 @@ static void sbus_dispatch(struct tevent_context *ev, DEBUG(SSSDBG_TRACE_ALL, "dbus conn: %p\n", dbus_conn); if (conn->retries > 0) { - DEBUG(6, "SBUS is reconnecting. Deferring.\n"); + DEBUG(SSSDBG_TRACE_FUNC, "SBUS is reconnecting. Deferring.\n"); /* Currently trying to reconnect, defer dispatch for 30ms */ tv = tevent_timeval_current_ofs(0, 30); new_event = tevent_add_timer(ev, conn, tv, sbus_dispatch, conn); if (new_event == NULL) { - DEBUG(0,"Could not defer dispatch!\n"); + DEBUG(SSSDBG_FATAL_FAILURE,"Could not defer dispatch!\n"); } return; } @@ -73,11 +73,11 @@ static void sbus_dispatch(struct tevent_context *ev, /* Attempt to reconnect automatically */ ret = sbus_auto_reconnect(conn); if (ret == EOK) { - DEBUG(1, "Performing auto-reconnect\n"); + DEBUG(SSSDBG_CRIT_FAILURE, "Performing auto-reconnect\n"); return; } - DEBUG(0, "Cannot start auto-reconnection.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Cannot start auto-reconnection.\n"); conn->reconnect_callback(conn, SBUS_RECONNECT_ERROR, conn->reconnect_pvt); @@ -86,7 +86,7 @@ static void sbus_dispatch(struct tevent_context *ev, if ((conn->disconnect) || (!dbus_connection_get_is_connected(dbus_conn))) { - DEBUG(3,"Connection is not open for dispatching.\n"); + DEBUG(SSSDBG_MINOR_FAILURE,"Connection is not open for dispatching.\n"); /* * Free the connection object. * This will invoke the destructor for the connection @@ -101,7 +101,7 @@ static void sbus_dispatch(struct tevent_context *ev, */ ret = dbus_connection_get_dispatch_status(dbus_conn); if (ret != DBUS_DISPATCH_COMPLETE) { - DEBUG(9,"Dispatching.\n"); + DEBUG(SSSDBG_TRACE_ALL,"Dispatching.\n"); dbus_connection_dispatch(dbus_conn); } @@ -112,7 +112,7 @@ static void sbus_dispatch(struct tevent_context *ev, if (ret != DBUS_DISPATCH_COMPLETE) { new_event = tevent_add_timer(ev, conn, tv, sbus_dispatch, conn); if (new_event == NULL) { - DEBUG(2,"Could not add dispatch event!\n"); + DEBUG(SSSDBG_OP_FAILURE,"Could not add dispatch event!\n"); /* TODO: Calling exit here is bad */ exit(1); @@ -140,7 +140,7 @@ static void sbus_conn_wakeup_main(void *data) /* D-BUS calls this function when it is time to do a dispatch */ te = tevent_add_timer(conn->ev, conn, tv, sbus_dispatch, conn); if (te == NULL) { - DEBUG(2,"Could not add dispatch event!\n"); + DEBUG(SSSDBG_OP_FAILURE,"Could not add dispatch event!\n"); /* TODO: Calling exit here is bad */ exit(1); } @@ -205,7 +205,8 @@ static int sbus_conn_set_fns(struct sbus_connection *conn) sbus_toggle_watch, conn, NULL); if (!dbret) { - DEBUG(2,"Error setting up D-BUS connection watch functions\n"); + DEBUG(SSSDBG_OP_FAILURE, + "Error setting up D-BUS connection watch functions\n"); return EIO; } @@ -216,7 +217,8 @@ static int sbus_conn_set_fns(struct sbus_connection *conn) sbus_toggle_timeout, conn, NULL); if (!dbret) { - DEBUG(2,"Error setting up D-BUS server timeout functions\n"); + DEBUG(SSSDBG_OP_FAILURE, + "Error setting up D-BUS server timeout functions\n"); /* FIXME: free resources ? */ return EIO; } @@ -252,7 +254,8 @@ int sbus_new_connection(TALLOC_CTX *ctx, struct tevent_context *ev, /* Open a shared D-BUS connection to the address */ dbus_conn = dbus_connection_open(address, &dbus_error); if (!dbus_conn) { - DEBUG(1, "Failed to open connection: name=%s, message=%s\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to open connection: name=%s, message=%s\n", dbus_error.name, dbus_error.message); if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); return EIO; @@ -308,7 +311,8 @@ int sbus_default_connection_destructor(void *ctx) } else { /* Critical Error! */ - DEBUG(1,"Critical Error, connection_type is neither shared nor private!\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Critical Error, connection_type is neither shared nor private!\n"); return -1; } @@ -411,7 +415,7 @@ DBusHandlerResult sbus_message_handler(DBusConnection *dbus_conn, intf_p = talloc_get_type(user_data, struct sbus_interface_p); method = dbus_message_get_member(message); - DEBUG(9, "Received SBUS method [%s]\n", method); + DEBUG(SSSDBG_TRACE_ALL, "Received SBUS method [%s]\n", method); path = dbus_message_get_path(message); msg_interface = dbus_message_get_interface(message); @@ -438,7 +442,8 @@ DBusHandlerResult sbus_message_handler(DBusConnection *dbus_conn, if (!found) { /* Reply DBUS_ERROR_UNKNOWN_METHOD */ - DEBUG(1, "No matching method found for %s.\n", method); + DEBUG(SSSDBG_CRIT_FAILURE, + "No matching method found for %s.\n", method); reply = dbus_message_new_error(message, DBUS_ERROR_UNKNOWN_METHOD, NULL); sbus_conn_send_reply(intf_p->conn, reply); dbus_message_unref(reply); @@ -485,7 +490,8 @@ int sbus_conn_add_interface(struct sbus_connection *conn, path = intf->path; if (path_in_interface_list(conn->intf_list, path)) { - DEBUG(0, "Cannot add method context with identical path.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, + "Cannot add method context with identical path.\n"); return EINVAL; } @@ -501,7 +507,8 @@ int sbus_conn_add_interface(struct sbus_connection *conn, dbret = dbus_connection_register_object_path(conn->dbus.conn, path, &intf->vtable, intf_p); if (!dbret) { - DEBUG(0, "Could not register object path to the connection.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, + "Could not register object path to the connection.\n"); return ENOMEM; } @@ -562,12 +569,12 @@ static void sbus_reconnect(struct tevent_context *ev, conn = talloc_get_type(data, struct sbus_connection); dbus_error_init(&dbus_error); - DEBUG(3, "Making reconnection attempt %d to [%s]\n", + DEBUG(SSSDBG_MINOR_FAILURE, "Making reconnection attempt %d to [%s]\n", conn->retries, conn->address); conn->dbus.conn = dbus_connection_open(conn->address, &dbus_error); if (conn->dbus.conn) { /* We successfully reconnected. Set up mainloop integration. */ - DEBUG(3, "Reconnected to [%s]\n", conn->address); + DEBUG(SSSDBG_MINOR_FAILURE, "Reconnected to [%s]\n", conn->address); ret = sbus_conn_set_fns(conn); if (ret != EOK) { dbus_connection_unref(conn->dbus.conn); @@ -582,7 +589,8 @@ static void sbus_reconnect(struct tevent_context *ev, &iter->intf->vtable, iter); if (!dbret) { - DEBUG(0, "Could not register object path.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, + "Could not register object path.\n"); dbus_connection_unref(conn->dbus.conn); goto failed; } @@ -603,7 +611,8 @@ static void sbus_reconnect(struct tevent_context *ev, failed: /* Reconnection failed, try again in a few seconds */ - DEBUG(1, "Failed to open connection: name=%s, message=%s\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to open connection: name=%s, message=%s\n", dbus_error.name, dbus_error.message); if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); @@ -721,7 +730,7 @@ int sbus_conn_send(struct sbus_connection *conn, * Critical Failure * Insufficient memory to send message */ - DEBUG(0, "D-BUS send failed.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "D-BUS send failed.\n"); return ENOMEM; } @@ -734,7 +743,7 @@ int sbus_conn_send(struct sbus_connection *conn, * Critical Failure * Insufficient memory to create pending call notify */ - DEBUG(0, "D-BUS send failed.\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "D-BUS send failed.\n"); dbus_pending_call_cancel(pending_reply); dbus_pending_call_unref(pending_reply); return ENOMEM; |