neels has submitted this change. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36890?usp=email )
Change subject: rename to umts_cell_id_to_str()
......................................................................
rename to umts_cell_id_to_str()
A subsequent patch adds umts_cell_id_to_str_buf(), and before the old
foo_name() pattern spreads further, I'd rather rename it.
Rationale:
- There is a umts_cell_id_from_str() function.
- The foo_name() is an old pattern, we prefer foo_to_str() now.
- Contained within osmo-hnbgw, no API problems.
Change-Id: I3124d1f5e634bc895ec347cb1a9816789fd9ab69
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw.c
M src/osmo-hnbgw/hnbgw_hnbap.c
M src/osmo-hnbgw/nft_kpi.c
4 files changed, 27 insertions(+), 10 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
laforge: Looks good to me, but someone else must approve
neels: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 666088c..2c7e014 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -173,7 +173,7 @@
uint16_t sac; /*!< Service Area Code */
uint32_t cid; /*!< Cell ID */
};
-const char *umts_cell_id_name(const struct umts_cell_id *ucid);
+const char *umts_cell_id_to_str(const struct umts_cell_id *ucid);
int umts_cell_id_from_str(struct umts_cell_id *ucid, const char *instr);
uint32_t umts_cell_id_hash(const struct umts_cell_id *ucid);
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index a36d107..c41fb54 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -232,7 +232,7 @@
return ctx;
}
-const char *umts_cell_id_name(const struct umts_cell_id *ucid)
+const char *umts_cell_id_to_str(const struct umts_cell_id *ucid)
{
const char *fmtstr = "%03u-%02u-L%u-R%u-S%u-C%u";
@@ -304,7 +304,7 @@
if (g_hnbgw->config.log_prefix_hnb_id)
result = talloc_asprintf(OTC_SELECT, "%s %s", result,
ctx->identity_info);
else
- result = talloc_asprintf(OTC_SELECT, "%s %s", result,
umts_cell_id_name(&ctx->id));
+ result = talloc_asprintf(OTC_SELECT, "%s %s", result,
umts_cell_id_to_str(&ctx->id));
return result;
}
@@ -544,7 +544,7 @@
return NULL;
hnbp->id = *id;
- hnbp->id_str = talloc_strdup(hnbp, umts_cell_id_name(id));
+ hnbp->id_str = talloc_strdup(hnbp, umts_cell_id_to_str(id));
hnbp->ctrs = rate_ctr_group_alloc(hnbp, &hnb_ctrg_desc, 0);
if (!hnbp->ctrs)
goto out_free;
diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index d7e4dc3..29851a0 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -503,7 +503,7 @@
osmo_plmn_from_bcd(ies.plmNidentity.buf, &plmn);
ctx->id.mcc = plmn.mcc;
ctx->id.mnc = plmn.mnc;
- cell_id_str = umts_cell_id_name(&ctx->id);
+ cell_id_str = umts_cell_id_to_str(&ctx->id);
if (getpeername(ofd->fd, &cur_osa.u.sa, &len) < 0) {
LOGHNB(ctx, DHNBAP, LOGL_ERROR, "HNB-REGISTER-REQ %s: rejecting due to
getpeername() error: %s\n",
diff --git a/src/osmo-hnbgw/nft_kpi.c b/src/osmo-hnbgw/nft_kpi.c
index 42c009f..9eff35e 100644
--- a/src/osmo-hnbgw/nft_kpi.c
+++ b/src/osmo-hnbgw/nft_kpi.c
@@ -361,7 +361,7 @@
{
char cmd[1024];
struct osmo_strbuf sb = { .buf = cmd, .len = sizeof(cmd) };
- const char *cell_id_str = umts_cell_id_name(&req->hnbp_init_remove.cell_id);
+ const char *cell_id_str = umts_cell_id_to_str(&req->hnbp_init_remove.cell_id);
OSMO_STRBUF_PRINTF(sb,
"add counter inet %s ul-%s;\n"
"add counter inet %s dl-%s;\n",
@@ -376,7 +376,7 @@
{
char cmd[1024];
struct osmo_strbuf sb = { .buf = cmd, .len = sizeof(cmd) };
- const char *cell_id_str = umts_cell_id_name(&req->hnbp_init_remove.cell_id);
+ const char *cell_id_str = umts_cell_id_to_str(&req->hnbp_init_remove.cell_id);
OSMO_STRBUF_PRINTF(sb,
"delete counter inet %s ul-%s;\n"
"delete counter inet %s dl-%s;\n",
@@ -406,7 +406,7 @@
{
char cmd[1024];
struct osmo_strbuf sb = { .buf = cmd, .len = sizeof(cmd) };
- const char *cell_id_str = umts_cell_id_name(&req->hnb_start.cell_id);
+ const char *cell_id_str = umts_cell_id_to_str(&req->hnb_start.cell_id);
int rc;
OSMO_STRBUF_PRINTF(sb,
@@ -911,7 +911,7 @@
/* Paranoid corner case: while we added the rules for this hNodeB, it was apparently
removed and does
* not exist anymore. We need to just drop the rules again right away. */
LOGP(DNFT, LOGL_ERROR, "Added nft rules for unknown cell %s; removing rules
again\n",
- umts_cell_id_name(&req->hnb_start.cell_id));
+ umts_cell_id_to_str(&req->hnb_start.cell_id));
drop_again = true;
}
@@ -921,7 +921,7 @@
* drop the rules again right away. */
LOGP(DNFT, LOGL_INFO,
"Cell %s disconnected before adding counter rules completed. removing rules
again\n",
- umts_cell_id_name(&req->hnb_start.cell_id));
+ umts_cell_id_to_str(&req->hnb_start.cell_id));
drop_again = true;
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36890?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I3124d1f5e634bc895ec347cb1a9816789fd9ab69
Gerrit-Change-Number: 36890
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: merged