[MERGED] osmo-pcu[master]: logging: use central filter and ctx consts from libosmocore

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 22 16:27:25 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: logging: use central filter and ctx consts from libosmocore
......................................................................


logging: use central filter and ctx consts from libosmocore

Change-Id: I7b41a5a26527864177c63403ad171d2987f0ff6a
Depends: libosmocore change-id I5c343630020f4b108099696fd96c2111614c8067
---
M src/gprs_bssgp_pcu.cpp
M src/gprs_debug.cpp
M src/gprs_debug.h
3 files changed, 7 insertions(+), 28 deletions(-)

Approvals:
  Neels Hofmeyr: Verified
  Harald Welte: Looks good to me, approved

Objections:
  Jenkins Builder: Fails



diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index da1d26c..f07b3a6 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -365,7 +365,7 @@
 
 	if (bctx)
 	{
-		log_set_context(BSC_CTX_BVC, bctx);
+		log_set_context(LOGGING_CTX_GB_BVC, bctx);
 		rate_ctr_inc(&bctx->ctrg->ctr[BSSGP_CTR_PKTS_IN]);
 		rate_ctr_add(&bctx->ctrg->ctr[BSSGP_CTR_BYTES_IN], msgb_bssgp_len(msg));
 	}
diff --git a/src/gprs_debug.cpp b/src/gprs_debug.cpp
index 3d9b816..6bb35ea 100644
--- a/src/gprs_debug.cpp
+++ b/src/gprs_debug.cpp
@@ -46,27 +46,20 @@
 	{"DPCU", "\033[1;35m", "GPRS Packet Control Unit (PCU)", LOGL_NOTICE, 1},
 };
 
-enum {
-	_FLT_ALL = LOG_FILTER_ALL,	/* libosmocore */
-	FLT_IMSI = 1,
-	FLT_NSVC = 2,
-	FLT_BVC  = 3,
-};
-
 static int filter_fn(const struct log_context *ctx,
 		     struct log_target *tar)
 {
-	const struct gprs_nsvc *nsvc = (const struct gprs_nsvc*)ctx->ctx[BSC_CTX_NSVC];
-	const struct gprs_nsvc *bvc = (const struct gprs_nsvc*)ctx->ctx[BSC_CTX_BVC];
+	const struct gprs_nsvc *nsvc = (const struct gprs_nsvc*)ctx->ctx[LOGGING_CTX_GB_NSVC];
+	const struct gprs_nsvc *bvc = (const struct gprs_nsvc*)ctx->ctx[LOGGING_CTX_GB_BVC];
 
 	/* Filter on the NS Virtual Connection */
-	if ((tar->filter_map & (1 << FLT_NSVC)) != 0
-	    && nsvc && (nsvc == tar->filter_data[FLT_NSVC]))
+	if ((tar->filter_map & (1 << LOGGING_FILTER_GB_NSVC)) != 0
+	    && nsvc && (nsvc == tar->filter_data[LOGGING_FILTER_GB_NSVC]))
 		return 1;
 
 	/* Filter on the BVC */
-	if ((tar->filter_map & (1 << FLT_BVC)) != 0
-	    && bvc && (bvc == tar->filter_data[FLT_BVC]))
+	if ((tar->filter_map & (1 << LOGGING_FILTER_GB_BVC)) != 0
+	    && bvc && (bvc == tar->filter_data[LOGGING_FILTER_GB_BVC]))
 		return 1;
 
 	return 0;
diff --git a/src/gprs_debug.h b/src/gprs_debug.h
index 963d841..817c41e 100644
--- a/src/gprs_debug.h
+++ b/src/gprs_debug.h
@@ -45,20 +45,6 @@
 	aDebug_LastEntry
 };
 
-/* context */
-#define BSC_CTX_SUBSCR	1
-#define BSC_CTX_NSVC	4
-#define BSC_CTX_BVC		5
-
-/* target */
-
-enum {
-	//DEBUG_FILTER_ALL = 1 << 0,
-	LOG_FILTER_IMSI = 1 << 1,
-	LOG_FILTER_NSVC = 1 << 2,
-	LOG_FILTER_BVC  = 1 << 3,
-};
-
 /* we don't need a header dependency for this... */
 
 struct gprs_nsvc;

-- 
To view, visit https://gerrit.osmocom.org/1847
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7b41a5a26527864177c63403ad171d2987f0ff6a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list