summaryrefslogtreecommitdiffstats
path: root/src/providers/fail_over.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-02-12 10:12:04 -0500
committerJakub Hrozek <jhrozek@redhat.com>2014-02-12 22:30:55 +0100
commita3c8390d19593b1e5277d95bfb4ab206d4785150 (patch)
tree2eb4e5432f4f79a75589c03b1513b656879ebf9c /src/providers/fail_over.c
parentcc026fd9ba386f2197e3217940d597dcad1a26fe (diff)
downloadsssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.gz
sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.tar.xz
sssd-a3c8390d19593b1e5277d95bfb4ab206d4785150.zip
Make DEBUG macro invocations variadic
Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; 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/providers/fail_over.c')
-rw-r--r--src/providers/fail_over.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index 98c200659..e8d49039a 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -140,12 +140,12 @@ fo_context_init(TALLOC_CTX *mem_ctx, struct fo_options *opts)
ctx = talloc_zero(mem_ctx, struct fo_ctx);
if (ctx == NULL) {
- DEBUG(1, ("No memory\n"));
+ DEBUG(1, "No memory\n");
return NULL;
}
ctx->opts = talloc_zero(ctx, struct fo_options);
if (ctx->opts == NULL) {
- DEBUG(1, ("No memory\n"));
+ DEBUG(1, "No memory\n");
return NULL;
}
@@ -155,8 +155,8 @@ fo_context_init(TALLOC_CTX *mem_ctx, struct fo_options *opts)
ctx->opts->service_resolv_timeout = opts->service_resolv_timeout;
DEBUG(SSSDBG_TRACE_FUNC,
- ("Created new fail over context, retry timeout is %ld\n",
- ctx->opts->retry_timeout));
+ "Created new fail over context, retry timeout is %ld\n",
+ ctx->opts->retry_timeout);
return ctx;
}
@@ -223,8 +223,8 @@ collapse_srv_lookup(struct fo_server **_server)
server = *_server;
meta = server->srv_data->meta;
- DEBUG(4, ("Need to refresh SRV lookup for domain %s\n",
- meta->srv_data->dns_domain));
+ DEBUG(4, "Need to refresh SRV lookup for domain %s\n",
+ meta->srv_data->dns_domain);
if (server != meta) {
while (server->prev && server->prev->srv_data == meta->srv_data) {
@@ -282,7 +282,7 @@ get_srv_data_status(struct srv_data *data)
data->last_status_change.tv_sec = 0;
break;
default:
- DEBUG(1, ("Unknown state for SRV server!\n"));
+ DEBUG(1, "Unknown state for SRV server!\n");
}
}
@@ -292,8 +292,8 @@ get_srv_data_status(struct srv_data *data)
static void
set_srv_data_status(struct srv_data *data, enum srv_lookup_status status)
{
- DEBUG(4, ("Marking SRV lookup of service '%s' as '%s'\n",
- data->meta->service->name, str_srv_data_status(status)));
+ DEBUG(4, "Marking SRV lookup of service '%s' as '%s'\n",
+ data->meta->service->name, str_srv_data_status(status));
gettimeofday(&data->last_status_change, NULL);
data->srv_lookup_status = status;
@@ -312,15 +312,15 @@ get_server_status(struct fo_server *server)
if (server->common == NULL)
return SERVER_NAME_RESOLVED;
- DEBUG(7, ("Status of server '%s' is '%s'\n", SERVER_NAME(server),
- str_server_status(server->common->server_status)));
+ DEBUG(7, "Status of server '%s' is '%s'\n", SERVER_NAME(server),
+ str_server_status(server->common->server_status));
timeout = server->service->ctx->opts->retry_timeout;
gettimeofday(&tv, NULL);
if (timeout != 0 && server->common->server_status == SERVER_NOT_WORKING) {
if (STATUS_DIFF(server->common, tv) > timeout) {
- DEBUG(4, ("Reseting the server status of '%s'\n",
- SERVER_NAME(server)));
+ DEBUG(4, "Reseting the server status of '%s'\n",
+ SERVER_NAME(server));
server->common->server_status = SERVER_NAME_NOT_RESOLVED;
server->common->last_status_change.tv_sec = tv.tv_sec;
}
@@ -328,8 +328,8 @@ get_server_status(struct fo_server *server)
if (server->common->rhostent && STATUS_DIFF(server->common, tv) >
server->common->rhostent->addr_list[0]->ttl) {
- DEBUG(4, ("Hostname resolution expired, resetting the server "
- "status of '%s'\n", SERVER_NAME(server)));
+ DEBUG(4, "Hostname resolution expired, resetting the server "
+ "status of '%s'\n", SERVER_NAME(server));
fo_set_server_status(server, SERVER_NAME_NOT_RESOLVED);
}
@@ -346,15 +346,15 @@ get_port_status(struct fo_server *server)
struct timeval tv;
time_t timeout;
- DEBUG(7, ("Port status of port %d for server '%s' is '%s'\n", server->port,
- SERVER_NAME(server), str_port_status(server->port_status)));
+ DEBUG(7, "Port status of port %d for server '%s' is '%s'\n", server->port,
+ SERVER_NAME(server), str_port_status(server->port_status));
timeout = server->service->ctx->opts->retry_timeout;
if (timeout != 0 && server->port_status == PORT_NOT_WORKING) {
gettimeofday(&tv, NULL);
if (STATUS_DIFF(server, tv) > timeout) {
- DEBUG(4, ("Reseting the status of port %d for server '%s'\n",
- server->port, SERVER_NAME(server)));
+ DEBUG(4, "Reseting the status of port %d for server '%s'\n",
+ server->port, SERVER_NAME(server));
server->port_status = PORT_NEUTRAL;
server->last_status_change.tv_sec = tv.tv_sec;
}
@@ -398,10 +398,10 @@ fo_new_service(struct fo_ctx *ctx, const char *name,
struct fo_service *service;
int ret;
- DEBUG(SSSDBG_TRACE_FUNC, ("Creating new service '%s'\n", name));
+ DEBUG(SSSDBG_TRACE_FUNC, "Creating new service '%s'\n", name);
ret = fo_get_service(ctx, name, &service);
if (ret == EOK) {
- DEBUG(5, ("Service '%s' already exists\n", name));
+ DEBUG(5, "Service '%s' already exists\n", name);
if (_service) {
*_service = service;
}
@@ -473,7 +473,7 @@ static int server_common_destructor(void *memptr)
common = talloc_get_type(memptr, struct server_common);
if (common->request_list) {
- DEBUG(1, ("BUG: pending requests still associated with this server\n"));
+ DEBUG(1, "BUG: pending requests still associated with this server\n");
return -1;
}
DLIST_REMOVE(common->ctx->server_common_list, common);
@@ -518,8 +518,8 @@ fo_add_srv_server(struct fo_service *service, const char *srv,
struct fo_server *server;
DEBUG(SSSDBG_TRACE_FUNC,
- ("Adding new SRV server to service '%s' using '%s'.\n",
- service->name, proto));
+ "Adding new SRV server to service '%s' using '%s'.\n",
+ service->name, proto);
DLIST_FOR_EACH(server, service->server_list) {
/* Compare user data only if user_data_cmp and both arguments
@@ -713,16 +713,16 @@ static errno_t fo_add_server_to_list(struct fo_server **to_list,
server->user_data);
if (exists) {
- DEBUG(SSSDBG_TRACE_FUNC, ("Server '%s:%d' for service '%s' "
- "is already present\n", debug_name, server->port, service_name));
+ DEBUG(SSSDBG_TRACE_FUNC, "Server '%s:%d' for service '%s' "
+ "is already present\n", debug_name, server->port, service_name);
return EEXIST;
}
DLIST_ADD_END(*to_list, server, struct fo_server *);
- DEBUG(SSSDBG_TRACE_FUNC, ("Inserted %s server '%s:%d' to service "
+ DEBUG(SSSDBG_TRACE_FUNC, "Inserted %s server '%s:%d' to service "
"'%s'\n", (server->primary ? "primary" : "backup"),
- debug_name, server->port, service_name));
+ debug_name, server->port, service_name);
return EOK;
}
@@ -879,7 +879,7 @@ set_lookup_hook(struct fo_server *server, struct tevent_req *req)
request = talloc(req, struct resolve_service_request);
if (request == NULL) {
- DEBUG(1, ("No memory\n"));
+ DEBUG(1, "No memory\n");
talloc_free(request);
return ENOMEM;
}
@@ -936,7 +936,7 @@ fo_resolve_service_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct tevent_req *subreq;
struct resolve_service_state *state;
- DEBUG(4, ("Trying to resolve service '%s'\n", service->name));
+ DEBUG(4, "Trying to resolve service '%s'\n", service->name);
req = tevent_req_create(mem_ctx, &state, struct resolve_service_state);
if (req == NULL)
return NULL;
@@ -947,7 +947,7 @@ fo_resolve_service_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
ret = get_first_server_entity(service, &server);
if (ret != EOK) {
- DEBUG(1, ("No available servers for service '%s'\n", service->name));
+ DEBUG(1, "No available servers for service '%s'\n", service->name);
goto done;
}
@@ -955,7 +955,7 @@ fo_resolve_service_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
ret = fo_resolve_service_activate_timeout(req, ev,
ctx->opts->service_resolv_timeout);
if (ret != EOK) {
- DEBUG(SSSDBG_OP_FAILURE, ("Could not set service timeout\n"));
+ DEBUG(SSSDBG_OP_FAILURE, "Could not set service timeout\n");
goto done;
}
@@ -999,7 +999,7 @@ fo_resolve_service_timeout(struct tevent_context *ev,
{
struct tevent_req *req = talloc_get_type(pvt, struct tevent_req);
- DEBUG(SSSDBG_MINOR_FAILURE, ("Service resolving timeout reached\n"));
+ DEBUG(SSSDBG_MINOR_FAILURE, "Service resolving timeout reached\n");
tevent_req_error(req, ETIMEDOUT);
}
@@ -1017,12 +1017,12 @@ fo_resolve_service_activate_timeout(struct tevent_req *req,
state->timeout_handler = tevent_add_timer(ev, state, tv,
fo_resolve_service_timeout, req);
if (state->timeout_handler == NULL) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("tevent_add_timer failed.\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "tevent_add_timer failed.\n");
return ENOMEM;
}
- DEBUG(SSSDBG_TRACE_INTERNAL, ("Resolve timeout set to %lu seconds\n",
- timeout_seconds));
+ DEBUG(SSSDBG_TRACE_INTERNAL, "Resolve timeout set to %lu seconds\n",
+ timeout_seconds);
return EOK;
}
@@ -1105,9 +1105,9 @@ fo_resolve_service_done(struct tevent_req *subreq)
&common->rhostent);
talloc_zfree(subreq);
if (ret != EOK) {
- DEBUG(1, ("Failed to resolve server '%s': %s\n",
+ DEBUG(1, "Failed to resolve server '%s': %s\n",
common->name,
- resolv_strerror(resolv_status)));
+ resolv_strerror(resolv_status));
/* If the resolver failed to resolve a hostname but did not
* encounter an error, tell the caller to retry another server.
*
@@ -1189,8 +1189,8 @@ resolve_srv_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
state->meta = server->srv_data->meta;
status = get_srv_data_status(server->srv_data);
- DEBUG(SSSDBG_FUNC_DATA, ("The status of SRV lookup is %s\n",
- str_srv_data_status(status)));
+ DEBUG(SSSDBG_FUNC_DATA, "The status of SRV lookup is %s\n",
+ str_srv_data_status(status));
switch(status) {
case SRV_EXPIRED: /* Need a refresh */
state->meta = collapse_srv_lookup(&server);
@@ -1207,7 +1207,7 @@ resolve_srv_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
}
if (ctx->srv_send_fn == NULL || ctx->srv_recv_fn == NULL) {
- DEBUG(SSSDBG_OP_FAILURE, ("No SRV lookup plugin is set\n"));
+ DEBUG(SSSDBG_OP_FAILURE, "No SRV lookup plugin is set\n");
ret = ENOTSUP;
goto done;
}
@@ -1234,7 +1234,7 @@ resolve_srv_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
tevent_req_post(req, state->ev);
return req;
default:
- DEBUG(1, ("Unexpected status %d for a SRV server\n", status));
+ DEBUG(1, "Unexpected status %d for a SRV server\n", status);
ret = EIO;
goto done;
}
@@ -1271,8 +1271,8 @@ resolve_srv_done(struct tevent_req *subreq)
case EOK:
if ((num_primary_servers == 0 || primary_servers == NULL)
&& (num_backup_servers == 0 || backup_servers == NULL)) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("SRV lookup plugin returned EOK but "
- "no servers\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "SRV lookup plugin returned EOK but "
+ "no servers\n");
ret = EFAULT;
goto done;
}
@@ -1308,8 +1308,8 @@ resolve_srv_done(struct tevent_req *subreq)
if (last_server == state->meta) {
/* SRV lookup returned only those servers
* that are already present. */
- DEBUG(SSSDBG_TRACE_FUNC, ("SRV lookup did not return "
- "any new server.\n"));
+ DEBUG(SSSDBG_TRACE_FUNC, "SRV lookup did not return "
+ "any new server.\n");
ret = ERR_SRV_DUPLICATES;
goto done;
}
@@ -1318,7 +1318,7 @@ resolve_srv_done(struct tevent_req *subreq)
* We will return the first new server. */
if (state->meta->next == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("BUG: state->meta->next is NULL\n"));
+ "BUG: state->meta->next is NULL\n");
ret = ERR_INTERNAL;
goto done;
}
@@ -1341,8 +1341,8 @@ resolve_srv_done(struct tevent_req *subreq)
fo_set_port_status(state->meta, PORT_NOT_WORKING);
/* fall through */
default:
- DEBUG(SSSDBG_OP_FAILURE, ("Unable to resolve SRV [%d]: %s\n",
- ret, sss_strerror(ret)));
+ DEBUG(SSSDBG_OP_FAILURE, "Unable to resolve SRV [%d]: %s\n",
+ ret, sss_strerror(ret));
}
done:
@@ -1385,8 +1385,8 @@ static void
set_server_common_status(struct server_common *common,
enum server_status status)
{
- DEBUG(4, ("Marking server '%s' as '%s'\n", common->name,
- str_server_status(status)));
+ DEBUG(4, "Marking server '%s' as '%s'\n", common->name,
+ str_server_status(status));
common->server_status = status;
gettimeofday(&common->last_status_change, NULL);
@@ -1396,7 +1396,7 @@ void
fo_set_server_status(struct fo_server *server, enum server_status status)
{
if (server->common == NULL) {
- DEBUG(1, ("Bug: Trying to set server status of a name-less server\n"));
+ DEBUG(1, "Bug: Trying to set server status of a name-less server\n");
return;
}
@@ -1408,8 +1408,8 @@ fo_set_port_status(struct fo_server *server, enum port_status status)
{
struct fo_server *siter;
- DEBUG(4, ("Marking port %d of server '%s' as '%s'\n", server->port,
- SERVER_NAME(server), str_port_status(status)));
+ DEBUG(4, "Marking port %d of server '%s' as '%s'\n", server->port,
+ SERVER_NAME(server), str_port_status(status));
server->port_status = status;
gettimeofday(&server->last_status_change, NULL);
@@ -1426,9 +1426,9 @@ fo_set_port_status(struct fo_server *server, enum port_status status)
DLIST_FOR_EACH(siter, server->service->server_list) {
if (fo_server_cmp(siter, server)) {
DEBUG(SSSDBG_TRACE_FUNC,
- ("Marking port %d of duplicate server '%s' as '%s'\n",
+ "Marking port %d of duplicate server '%s' as '%s'\n",
siter->port, SERVER_NAME(siter),
- str_port_status(status)));
+ str_port_status(status));
siter->port_status = status;
gettimeofday(&siter->last_status_change, NULL);
}
@@ -1440,7 +1440,7 @@ void fo_try_next_server(struct fo_service *service)
struct fo_server *server;
if (!service) {
- DEBUG(1, ("Bug: No service supplied\n"));
+ DEBUG(1, "Bug: No service supplied\n");
return;
}
@@ -1493,7 +1493,7 @@ struct resolv_hostent *
fo_get_server_hostent(struct fo_server *server)
{
if (server->common == NULL) {
- DEBUG(1, ("Bug: Trying to get hostent from a name-less server\n"));
+ DEBUG(1, "Bug: Trying to get hostent from a name-less server\n");
return NULL;
}
@@ -1559,12 +1559,12 @@ bool fo_set_srv_lookup_plugin(struct fo_ctx *ctx,
void *pvt)
{
if (ctx == NULL || send_fn == NULL || recv_fn == NULL) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Invalid parameters\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, "Invalid parameters\n");
return false;
}
if (ctx->srv_send_fn != NULL || ctx->srv_recv_fn != NULL) {
- DEBUG(SSSDBG_MINOR_FAILURE, ("SRV lookup plugin is already set\n"));
+ DEBUG(SSSDBG_MINOR_FAILURE, "SRV lookup plugin is already set\n");
return false;
}