On (10/08/15 19:28), Michal Židek wrote:
See attached patch that adds debug messages
Michal
From 8d3a54ee023ccb5bc37201a7c2fb1ec671134c1f Mon Sep 17 00:00:00
2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek(a)redhat.com>
Date: Mon, 10 Aug 2015 18:35:16 +0200
Subject: [PATCH] DEBUG: Add new debug category for fail over.
---
src/providers/data_provider_fo.c | 8 ++++----
src/providers/dp_backend.h | 27 +++++++++++++++++++++++----
src/util/util.h | 1 +
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c
index dab796d..de8a223 100644
--- a/src/providers/data_provider_fo.c
+++ b/src/providers/data_provider_fo.c
@@ -743,10 +743,10 @@ void reset_fo(struct be_ctx *be_ctx)
fo_reset_services(be_ctx->be_fo->fo_ctx);
}
-void be_fo_set_port_status(struct be_ctx *ctx,
- const char *service_name,
- struct fo_server *server,
- enum port_status status)
+void _be_fo_set_port_status(struct be_ctx *ctx,
+ const char *service_name,
+ struct fo_server *server,
+ enum port_status status)
{
struct be_svc_data *be_svc;
diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h
index e4e22ea..18a78a0 100644
--- a/src/providers/dp_backend.h
+++ b/src/providers/dp_backend.h
@@ -259,10 +259,29 @@ struct tevent_req *be_resolve_server_send(TALLOC_CTX *memctx,
bool first_try);
int be_resolve_server_recv(struct tevent_req *req, struct fo_server **srv);
-void be_fo_set_port_status(struct be_ctx *ctx,
- const char *service_name,
- struct fo_server *server,
- enum port_status status);
+#define be_fo_set_port_status(ctx, \
You can change be_fo_set_port_status to new
static function with prefix "_"
and backwark compatible function wit the same name will be thin wrapper
around it. We should not abuse macro.
If you are woried about performance it's better to reply on gcc and inlining of
functions. It's better to rely on type check of functions.
+ service_name, \
+ server, \
+ status) \
+do { \
+ switch (status) { \
+ case PORT_NEUTRAL: \
+ DEBUG(SSSDBG_BE_FO, "Setting status: PORT_NEUTRAL\n"); \
+ break; \
+ case PORT_WORKING: \
+ DEBUG(SSSDBG_BE_FO, "Setting status: PORT_WORKING\n"); \
+ break; \
+ case PORT_NOT_WORKING: \
+ DEBUG(SSSDBG_BE_FO, "Setting status: PORT_NOT_WORKING\n"); \
+ break; \
+ } \
I still
+ _be_fo_set_port_status(ctx, service_name, server, status); \
+} while (0)
+
+void _be_fo_set_port_status(struct be_ctx *ctx,
+ const char *service_name,
+ struct fo_server *server,
+ enum port_status status);
/*
* Instruct fail-over to try next server on the next connect attempt.
diff --git a/src/util/util.h b/src/util/util.h
index 94a3dde..aac91c8 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -92,6 +92,7 @@ int get_fd_from_debug_file(void);
#define SSSDBG_TRACE_LIBS 0x1000 /* level 7 */
#define SSSDBG_TRACE_INTERNAL 0x2000 /* level 8 */
#define SSSDBG_TRACE_ALL 0x4000 /* level 9 */
+#define SSSDBG_BE_FO 0x8000
Could you also map new debug level to old one?
(probably 9)
So pleaple who are used to for old style debug_levels
will not miss these debug messages.
LS