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/tools/sss_cache.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/tools/sss_cache.c')
| -rw-r--r-- | src/tools/sss_cache.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index 77cba461..ffa4e35e 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -450,14 +450,15 @@ static errno_t invalidate_entry(TALLOC_CTX *ctx, return EINVAL; } if (ret != EOK) { - DEBUG(3, "Could not set entry attributes\n"); + DEBUG(SSSDBG_MINOR_FAILURE, "Could not set entry attributes\n"); } } else { - DEBUG(3, "Could not add expiration time to attributes\n"); + DEBUG(SSSDBG_MINOR_FAILURE, + "Could not add expiration time to attributes\n"); } talloc_zfree(sys_attrs); } else { - DEBUG(3, "Could not create sysdb attributes\n"); + DEBUG(SSSDBG_MINOR_FAILURE, "Could not create sysdb attributes\n"); ret = ENOMEM; } return ret; @@ -478,7 +479,8 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain) ret = confdb_init(ctx, &ctx->confdb, confdb_path); talloc_free(confdb_path); if (ret != EOK) { - DEBUG(1, "Could not initialize connection to the confdb\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Could not initialize connection to the confdb\n"); return ret; } @@ -487,21 +489,23 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain) domain, DB_PATH, &ctx->domains); if (ret != EOK) { SYSDB_VERSION_ERROR(ret); - DEBUG(1, "Could not initialize connection to the sysdb\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Could not initialize connection to the sysdb\n"); return ret; } } else { ret = confdb_get_domains(ctx->confdb, &ctx->domains); if (ret != EOK) { - DEBUG(1, "Could not initialize domains\n"); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not initialize domains\n"); return ret; } ret = sysdb_init(ctx, ctx->domains, false); SYSDB_VERSION_ERROR(ret); if (ret != EOK) { - DEBUG(1, "Could not initialize connection to the sysdb\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Could not initialize connection to the sysdb\n"); return ret; } } @@ -566,7 +570,8 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) ret = set_locale(); if (ret != EOK) { - DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); + DEBUG(SSSDBG_CRIT_FAILURE, + "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); goto fini; } @@ -613,7 +618,8 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) ctx = talloc_zero(NULL, struct cache_tool_ctx); if (ctx == NULL) { - DEBUG(1, "Could not allocate memory for tools context\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Could not allocate memory for tools context\n"); ret = ENOMEM; goto fini; } @@ -667,7 +673,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) (user && !ctx->user_name) || (group && !ctx->group_name) || (netgroup && !ctx->netgroup_name) || (map && !ctx->autofs_name) || (service && !ctx->service_name)) { - DEBUG(1, "Construction of filters failed\n"); + DEBUG(SSSDBG_CRIT_FAILURE, "Construction of filters failed\n"); ret = ENOMEM; goto fini; } |
