Change in osmo-pcu[master]: gprs_ms: Move creating string name of object to a function
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29844 ) Change subject: gprs_ms: Move creating string name of object to a function .. gprs_ms: Move creating string name of object to a function This way it can be used outside of LOGPMS(). Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249 --- M src/gprs_ms.c M src/gprs_ms.h 2 files changed, 21 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved diff --git a/src/gprs_ms.c b/src/gprs_ms.c index 8453f20..d68f8aa 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -942,6 +942,24 @@ return NULL; } +const char *ms_name(const struct GprsMs *ms) +{ + static char _ms_name_buf[128]; + return ms_name_buf(ms, _ms_name_buf, sizeof(_ms_name_buf)); +} + +char *ms_name_buf(const struct GprsMs *ms, char *buf, unsigned int buf_size) +{ + snprintf(buf, buf_size - 1, + "MS(TLLI=0x%08x, IMSI=%s, TA=%" PRIu8 ", %" PRIu8 "/%" PRIu8 ",%s%s)", + ms_tlli(ms), ms_imsi(ms), ms_ta(ms), + ms_ms_class(ms), ms_egprs_ms_class(ms), + ms_ul_tbf(ms) ? " UL" : "", + ms_dl_tbf(ms) ? " DL" : ""); + buf[buf_size - 1] = '\0'; + return buf; +} + int ms_nacc_start(struct GprsMs *ms, Packet_Cell_Change_Notification_t *notif) { if (!ms->nacc) diff --git a/src/gprs_ms.h b/src/gprs_ms.h index c5ee01c..cc92e2a 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -134,6 +134,8 @@ static inline struct gprs_rlcmac_ul_tbf *ms_ul_tbf(const struct GprsMs *ms) {return ms->ul_tbf;} static inline struct gprs_rlcmac_dl_tbf *ms_dl_tbf(const struct GprsMs *ms) {return ms->dl_tbf;} +const char *ms_name(const struct GprsMs *ms); +char *ms_name_buf(const struct GprsMs *ms, char *buf, unsigned int buf_size); void ms_set_callback(struct GprsMs *ms, struct gpr_ms_callback *cb); @@ -237,11 +239,7 @@ } #define LOGPMS(ms, category, level, fmt, args...) \ - LOGP(category, level, "MS(TLLI=0x%08x, IMSI=%s, TA=%" PRIu8 ", %" PRIu8 "/%" PRIu8 ",%s%s) " fmt, \ -ms_tlli(ms), ms_imsi(ms), ms_ta(ms), ms_ms_class(ms), ms_egprs_ms_class(ms), \ -ms_ul_tbf(ms) ? " UL": "", \ -ms_dl_tbf(ms) ? " DL": "", \ -## args) + LOGP(category, level, "%s " fmt, ms_name(ms), ## args) #ifdef __cplusplus } -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29844 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249 Gerrit-Change-Number: 29844 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: keith Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-MessageType: merged
Change in osmo-pcu[master]: gprs_ms: Move creating string name of object to a function
Attention is currently required from: pespin, keith. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29844 ) Change subject: gprs_ms: Move creating string name of object to a function .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29844 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249 Gerrit-Change-Number: 29844 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: keith Gerrit-Reviewer: osmith Gerrit-Attention: pespin Gerrit-Attention: keith Gerrit-Comment-Date: Mon, 24 Oct 2022 11:47:05 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-pcu[master]: gprs_ms: Move creating string name of object to a function
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29844 ) Change subject: gprs_ms: Move creating string name of object to a function .. Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29844 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249 Gerrit-Change-Number: 29844 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Attention: pespin Gerrit-Comment-Date: Fri, 21 Oct 2022 18:53:37 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-pcu[master]: gprs_ms: Move creating string name of object to a function
pespin has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/osmo-pcu/+/29844 ) Change subject: gprs_ms: Move creating string name of object to a function .. gprs_ms: Move creating string name of object to a function This way it can be used outside of LOGPMS(). Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249 --- M src/gprs_ms.c M src/gprs_ms.h 2 files changed, 21 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/44/29844/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/29844 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I8ab713154c8f308878f3e85b6f7e8afc5c4be249 Gerrit-Change-Number: 29844 Gerrit-PatchSet: 2 Gerrit-Owner: pespin Gerrit-CC: Jenkins Builder Gerrit-MessageType: newpatchset