pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/30619 )


Change subject: pdch: Introduce APIs to print PDCH name
......................................................................

pdch: Introduce APIs to print PDCH name

This will allow printing PDCH with same formatting outside of LOGPDCH.

Change-Id: If18cb4a48237751e0dddede6793191b36dfe386d
---
M src/pdch.cpp
M src/pdch.h
2 files changed, 17 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/19/30619/1

diff --git a/src/pdch.cpp b/src/pdch.cpp
index 5a683ff..a16d6fe 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -1336,3 +1336,17 @@
               pdch->assigned_tfi(GPRS_RLCMAC_DL_TBF) == NO_FREE_TFI ||
               find_free_usf(pdch->assigned_usf()) < 0;
 }
+
+const char *pdch_name(const struct gprs_rlcmac_pdch *pdch)
+{
+       static char _pdch_name_buf[128];
+       return pdch_name_buf(pdch, _pdch_name_buf, sizeof(_pdch_name_buf));
+}
+
+char *pdch_name_buf(const struct gprs_rlcmac_pdch *pdch, char *buf, unsigned 
int buf_size)
+{
+       struct osmo_strbuf sb = { .buf = buf, .len = buf_size };
+       OSMO_STRBUF_PRINTF(sb, "PDCH(bts=%" PRIu8 ",trx=%" PRIu8 ",ts=%" PRIu8 
")",
+                          pdch->trx->bts->nr, pdch->trx->trx_no, pdch->ts_no);
+       return buf;
+}
\ No newline at end of file
diff --git a/src/pdch.h b/src/pdch.h
index cf4ac4e..5d55e7d 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -191,11 +191,11 @@
 void pdch_disable(struct gprs_rlcmac_pdch *pdch);
 bool pdch_is_enabled(const struct gprs_rlcmac_pdch *pdch);
 bool pdch_is_full(const struct gprs_rlcmac_pdch *pdch);
+const char *pdch_name(const struct gprs_rlcmac_pdch *pdch);
+char *pdch_name_buf(const struct gprs_rlcmac_pdch *pdch, char *buf, unsigned 
int buf_size);
 #ifdef __cplusplus
 }
 #endif

 #define LOGPDCH(pdch, category, level, fmt, args...) \
-       LOGP(category, level, "PDCH(bts=%" PRIu8 ",trx=%" PRIu8 ",ts=%" PRIu8 
") " fmt, \
-            (pdch)->trx->bts->nr, (pdch)->trx->trx_no, (pdch)->ts_no, \
-            ## args)
+       LOGP(category, level, "%s " fmt, pdch_name(pdch), ## args)

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/30619
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: If18cb4a48237751e0dddede6793191b36dfe386d
Gerrit-Change-Number: 30619
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to