From a8643789363a831a1431300205e0b11675556e08 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 13 Nov 2021 09:54:17 +0100 Subject: [PATCH] lapd: don't add parenthesis around datalink name The name [printing] works like this: * libosmo-abis:lapd tells libosmogsm:lapd_core a name for each data link * libosmgsm:lapd_core assumes this name has no paranthesis and puts additional parenthesis around it in macros like LOGDL However, current libosmo-abis:lapd [before this patch] adds its own set of parenthesis, causing all ISDN-LAPD related log messages generated by libosmgsm:lapd_core to have double-parenthesis. So we have to remove the parenthesis from lapd_datalink.name and lapd_instance.name to fix the log lines printed in libosmocore. This in turn means we have to add parenthesis to some log statements here in libosmo-abis:lapd. Why can't we instead modify libosmogsm:lapd_core to drop parenthesis there? Becaus it is also used by LAPDm code in osmo-bts, and those two get it right :) Change-Id: I688cf2a73a8c31cb3cf66ec005d02a14de197008 Related: Ie6742843fff809edffcac24c4dce4edf66bc71be Related: OS#1938 --- src/input/lapd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/input/lapd.c b/src/input/lapd.c index d8c67e4..6f1e270 100644 --- a/src/input/lapd.c +++ b/src/input/lapd.c @@ -74,13 +74,13 @@ #define LAPD_SET_K(n, o) {n,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o} #define LOGLI(li, level, fmt, args ...) \ - LOGP(DLLAPD, level, "%s: " fmt, (li)->name, ## args) + LOGP(DLLAPD, level, "(%s): " fmt, (li)->name, ## args) #define LOGTEI(teip, level, fmt, args ...) \ LOGP(DLLAPD, level, "(%s-T%u): " fmt, (teip)->li->name, (teip)->tei, ## args) #define LOGSAP(sap, level, fmt, args ...) \ - LOGP(DLLAPD, level, "%s: " fmt, (sap)->dl.name, ## args) + LOGP(DLLAPD, level, "(%s): " fmt, (sap)->dl.name, ## args) #define DLSAP_MSGB_SIZE 128 #define DLSAP_MSGB_HEADROOM 56 @@ -240,14 +240,14 @@ static struct lapd_sap *lapd_sap_alloc(struct lapd_tei *teip, uint8_t sapi) char name[256]; int k; - snprintf(name, sizeof(name), "(%s-T%u-S%u)", li->name, teip->tei, sapi); + snprintf(name, sizeof(name), "%s-T%u-S%u", li->name, teip->tei, sapi); sap = talloc_zero(teip, struct lapd_sap); if (!sap) return NULL; LOGP(DLLAPD, LOGL_NOTICE, - "%s: LAPD Allocating SAP for SAPI=%u / TEI=%u (dl=%p, sap=%p)\n", + "(%s): LAPD Allocating SAP for SAPI=%u / TEI=%u (dl=%p, sap=%p)\n", name, sapi, teip->tei, &sap->dl, sap); sap->sapi = sapi; @@ -256,7 +256,7 @@ static struct lapd_sap *lapd_sap_alloc(struct lapd_tei *teip, uint8_t sapi) profile = &li->profile; k = profile->k[sapi & 0x3f]; - LOGP(DLLAPD, LOGL_NOTICE, "%s: k=%d N200=%d N201=%d T200=%d.%d T203=%d.%d\n", + LOGP(DLLAPD, LOGL_NOTICE, "(%s): k=%d N200=%d N201=%d T200=%d.%d T203=%d.%d\n", name, k, profile->n200, profile->n201, profile->t200_sec, profile->t200_usec, profile->t203_sec, profile->t203_usec); lapd_dl_init2(dl, k, 128, profile->n201, name);