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
This commit is contained in:
Harald Welte 2021-11-13 09:54:17 +01:00 committed by laforge
parent a6eda5ae01
commit a864378936
1 changed files with 5 additions and 5 deletions

View File

@ -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);