[PATCH 5/5] src: use namespace prefix osmo_counter*

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

pablo at gnumonks.org pablo at gnumonks.org
Fri May 6 10:31:28 UTC 2011


From: Pablo Neira Ayuso <pablo at gnumonks.org>

Summary of changes:

s/struct counter/struct osmo_counter/g
s/counter_inc/osmo_counter_inc/g
s/counter_get/osmo_counter_get/g
s/counter_reset/osmo_counter_reset/g
s/counter_alloc/osmo_counter_alloc/g
s/counter_free/osmo_counter_free
---
 openbsc/include/openbsc/bsc_nat.h         |   12 +++---
 openbsc/include/openbsc/db.h              |    4 +-
 openbsc/include/openbsc/gsm_data.h        |   60 ++++++++++++++--------------
 openbsc/src/libbsc/abis_rsl.c             |    8 ++--
 openbsc/src/libbsc/bsc_init.c             |    4 +-
 openbsc/src/libbsc/bsc_vty.c              |   18 ++++----
 openbsc/src/libbsc/gsm_04_08_utils.c      |    2 +-
 openbsc/src/libbsc/handover_logic.c       |   10 ++--
 openbsc/src/libbsc/paging.c               |    6 +-
 openbsc/src/libcommon/gsm_data.c          |   60 ++++++++++++++--------------
 openbsc/src/libmsc/db.c                   |    2 +-
 openbsc/src/libmsc/gsm_04_08.c            |   20 +++++-----
 openbsc/src/libmsc/gsm_04_11.c            |   10 ++--
 openbsc/src/libmsc/vty_interface_layer3.c |   44 ++++++++++----------
 openbsc/src/osmo-bsc_nat/bsc_nat.c        |    6 +-
 openbsc/src/osmo-bsc_nat/bsc_nat_utils.c  |   12 +++---
 openbsc/src/osmo-bsc_nat/bsc_nat_vty.c    |   10 ++--
 openbsc/src/osmo-bsc_nat/bsc_sccp.c       |    2 +-
 openbsc/src/osmo-bsc_nat/bsc_ussd.c       |    2 +-
 openbsc/src/osmo-nitb/bsc_hack.c          |    4 +-
 openbsc/src/utils/bs11_config.c           |    2 +-
 21 files changed, 149 insertions(+), 149 deletions(-)

diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 52b2ce5..0894f25 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -179,21 +179,21 @@ struct bsc_endpoint {
  */
 struct bsc_nat_statistics {
 	struct {
-		struct counter *conn;
-		struct counter *calls;
+		struct osmo_counter *conn;
+		struct osmo_counter *calls;
 	} sccp;
 
 	struct {
-		struct counter *reconn;
-                struct counter *auth_fail;
+		struct osmo_counter *reconn;
+                struct osmo_counter *auth_fail;
 	} bsc;
 
 	struct {
-		struct counter *reconn;
+		struct osmo_counter *reconn;
 	} msc;
 
 	struct {
-		struct counter *reconn;
+		struct osmo_counter *reconn;
 	} ussd;
 };
 
diff --git a/openbsc/include/openbsc/db.h b/openbsc/include/openbsc/db.h
index 818d3d4..37011a1 100644
--- a/openbsc/include/openbsc/db.h
+++ b/openbsc/include/openbsc/db.h
@@ -73,8 +73,8 @@ int db_apdu_blob_store(struct gsm_subscriber *subscr,
 			uint8_t *apdu);
 
 /* Statistics counter storage */
-struct counter;
-int db_store_counter(struct counter *ctr);
+struct osmo_counter;
+int db_store_counter(struct osmo_counter *ctr);
 struct rate_ctr_group;
 int db_store_rate_ctr_group(struct rate_ctr_group *ctrg);
 
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index e6d6467..bc276d1 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -646,52 +646,52 @@ struct gsm_bts {
 /* Some statistics of our network */
 struct gsmnet_stats {
 	struct {
-		struct counter *total;
-		struct counter *no_channel;
+		struct osmo_counter *total;
+		struct osmo_counter *no_channel;
 	} chreq;
 	struct {
-		struct counter *attempted;
-		struct counter *no_channel;	/* no channel available */
-		struct counter *timeout;		/* T3103 timeout */
-		struct counter *completed;	/* HO COMPL received */
-		struct counter *failed;		/* HO FAIL received */
+		struct osmo_counter *attempted;
+		struct osmo_counter *no_channel;	/* no channel available */
+		struct osmo_counter *timeout;		/* T3103 timeout */
+		struct osmo_counter *completed;	/* HO COMPL received */
+		struct osmo_counter *failed;		/* HO FAIL received */
 	} handover;
 	struct {
-		struct counter *attach;
-		struct counter *normal;
-		struct counter *periodic;
-		struct counter *detach;
+		struct osmo_counter *attach;
+		struct osmo_counter *normal;
+		struct osmo_counter *periodic;
+		struct osmo_counter *detach;
 	} loc_upd_type;
 	struct {
-		struct counter *reject;
-		struct counter *accept;
+		struct osmo_counter *reject;
+		struct osmo_counter *accept;
 	} loc_upd_resp;
 	struct {
-		struct counter *attempted;
-		struct counter *detached;
-		struct counter *completed;
-		struct counter *expired;
+		struct osmo_counter *attempted;
+		struct osmo_counter *detached;
+		struct osmo_counter *completed;
+		struct osmo_counter *expired;
 	} paging;
 	struct {
-		struct counter *submitted; /* MO SMS submissions */
-		struct counter *no_receiver;
-		struct counter *delivered; /* MT SMS deliveries */
-		struct counter *rp_err_mem;
-		struct counter *rp_err_other;
+		struct osmo_counter *submitted; /* MO SMS submissions */
+		struct osmo_counter *no_receiver;
+		struct osmo_counter *delivered; /* MT SMS deliveries */
+		struct osmo_counter *rp_err_mem;
+		struct osmo_counter *rp_err_other;
 	} sms;
 	struct {
-		struct counter *mo_setup;
-		struct counter *mo_connect_ack;
-		struct counter *mt_setup;
-		struct counter *mt_connect;
+		struct osmo_counter *mo_setup;
+		struct osmo_counter *mo_connect_ack;
+		struct osmo_counter *mt_setup;
+		struct osmo_counter *mt_connect;
 	} call;
 	struct {
-		struct counter *rf_fail;
-		struct counter *rll_err;
+		struct osmo_counter *rf_fail;
+		struct osmo_counter *rll_err;
 	} chan;
 	struct {
-		struct counter *oml_fail;
-		struct counter *rsl_fail;
+		struct osmo_counter *oml_fail;
+		struct osmo_counter *rsl_fail;
 	} bts;
 };
 
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 4d61dc0..1001003 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -922,7 +922,7 @@ static int rsl_rx_conn_fail(struct msgb *msg)
 
 	LOGPC(DRSL, LOGL_NOTICE, "\n");
 	/* FIXME: only free it after channel release ACK */
-	counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rf_fail);
+	osmo_counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rf_fail);
 	return rsl_rf_chan_release(msg->lchan, 1);
 }
 
@@ -1268,7 +1268,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
 	lctype = get_ctype_by_chreq(bts->network, rqd_ref->ra);
 	chreq_reason = get_reason_by_chreq(rqd_ref->ra, bts->network->neci);
 
-	counter_inc(bts->network->stats.chreq.total);
+	osmo_counter_inc(bts->network->stats.chreq.total);
 
 	/*
 	 * We want LOCATION UPDATES to succeed and will assign a TCH
@@ -1281,7 +1281,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
 	if (!lchan) {
 		LOGP(DRSL, LOGL_NOTICE, "BTS %d CHAN RQD: no resources for %s 0x%x\n",
 		     msg->lchan->ts->trx->bts->nr, gsm_lchant_name(lctype), rqd_ref->ra);
-		counter_inc(bts->network->stats.chreq.no_channel);
+		osmo_counter_inc(bts->network->stats.chreq.no_channel);
 		/* FIXME gather multiple CHAN RQD and reject up to 4 at the same time */
 		if (bts->network->T3122)
 			rsl_send_imm_ass_rej(bts, 1, rqd_ref, bts->network->T3122 & 0xff);
@@ -1436,7 +1436,7 @@ static int rsl_rx_rll_err_ind(struct msgb *msg)
 	rll_indication(msg->lchan, rllh->link_id, BSC_RLLR_IND_ERR_IND);
 
 	if (rlm_cause[1] == RLL_CAUSE_T200_EXPIRED) {
-		counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rll_err);
+		osmo_counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rll_err);
 		return rsl_rf_chan_release(msg->lchan, 1);
 	}
 
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 0056bb0..8e62dac 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -275,9 +275,9 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
 		LOGP(DMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", isd->link_type, trx);
 
 		if (isd->link_type == E1INP_SIGN_OML)
-			counter_inc(trx->bts->network->stats.bts.oml_fail);
+			osmo_counter_inc(trx->bts->network->stats.bts.oml_fail);
 		else if (isd->link_type == E1INP_SIGN_RSL)
-			counter_inc(trx->bts->network->stats.bts.rsl_fail);
+			osmo_counter_inc(trx->bts->network->stats.bts.rsl_fail);
 
 		/*
 		 * free all allocated channels. change the nm_state so the
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 5a4bd6e..4cd027f 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -2518,18 +2518,18 @@ DEFUN(cfg_ts_e1_subslot,
 void openbsc_vty_print_statistics(struct vty *vty, struct gsm_network *net)
 {
 	vty_out(vty, "Channel Requests        : %lu total, %lu no channel%s",
-		counter_get(net->stats.chreq.total),
-		counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
+		osmo_counter_get(net->stats.chreq.total),
+		osmo_counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
 	vty_out(vty, "Channel Failures        : %lu rf_failures, %lu rll failures%s",
-		counter_get(net->stats.chan.rf_fail),
-		counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
+		osmo_counter_get(net->stats.chan.rf_fail),
+		osmo_counter_get(net->stats.chan.rll_err), VTY_NEWLINE);
 	vty_out(vty, "Paging                  : %lu attempted, %lu complete, %lu expired%s",
-		counter_get(net->stats.paging.attempted),
-		counter_get(net->stats.paging.completed),
-		counter_get(net->stats.paging.expired), VTY_NEWLINE);
+		osmo_counter_get(net->stats.paging.attempted),
+		osmo_counter_get(net->stats.paging.completed),
+		osmo_counter_get(net->stats.paging.expired), VTY_NEWLINE);
 	vty_out(vty, "BTS failures            : %lu OML, %lu RSL%s",
-		counter_get(net->stats.bts.oml_fail),
-		counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
+		osmo_counter_get(net->stats.bts.oml_fail),
+		osmo_counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
 }
 
 DEFUN(logging_fltr_imsi,
diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c
index 1cff1d9..7599cea 100644
--- a/openbsc/src/libbsc/gsm_04_08_utils.c
+++ b/openbsc/src/libbsc/gsm_04_08_utils.c
@@ -300,7 +300,7 @@ int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn,
 		subscr = conn->subscr;
 	}
 
-	counter_inc(bts->network->stats.paging.completed);
+	osmo_counter_inc(bts->network->stats.paging.completed);
 
 	/* Stop paging on the bts we received the paging response */
 	paging_request_stop(conn->bts, subscr, conn, msg);
diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c
index 1aa8fde..0f1582e 100644
--- a/openbsc/src/libbsc/handover_logic.c
+++ b/openbsc/src/libbsc/handover_logic.c
@@ -96,7 +96,7 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
 	DEBUGP(DHO, "(old_lchan on BTS %u, new BTS %u)\n",
 		old_lchan->ts->trx->bts->nr, bts->nr);
 
-	counter_inc(bts->network->stats.handover.attempted);
+	osmo_counter_inc(bts->network->stats.handover.attempted);
 
 	if (!old_lchan->conn) {
 		LOGP(DHO, LOGL_ERROR, "Old lchan lacks connection data.\n");
@@ -106,7 +106,7 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts)
 	new_lchan = lchan_alloc(bts, old_lchan->type, 0);
 	if (!new_lchan) {
 		LOGP(DHO, LOGL_NOTICE, "No free channel\n");
-		counter_inc(bts->network->stats.handover.no_channel);
+		osmo_counter_inc(bts->network->stats.handover.no_channel);
 		return -ENOSPC;
 	}
 
@@ -182,7 +182,7 @@ static void ho_T3103_cb(void *_ho)
 	struct gsm_network *net = ho->new_lchan->ts->trx->bts->network;
 
 	DEBUGP(DHO, "HO T3103 expired\n");
-	counter_inc(net->stats.handover.timeout);
+	osmo_counter_inc(net->stats.handover.timeout);
 
 	ho->new_lchan->conn->ho_lchan = NULL;
 	ho->new_lchan->conn = NULL;
@@ -262,7 +262,7 @@ static int ho_gsm48_ho_compl(struct gsm_lchan *new_lchan)
 	     ho->old_lchan->ts->trx->bts->nr, new_lchan->ts->trx->bts->nr,
 	     ho->old_lchan->ts->trx->arfcn, new_lchan->ts->trx->arfcn);
 
-	counter_inc(net->stats.handover.completed);
+	osmo_counter_inc(net->stats.handover.completed);
 
 	osmo_timer_del(&ho->T3103);
 
@@ -300,7 +300,7 @@ static int ho_gsm48_ho_fail(struct gsm_lchan *old_lchan)
 		return -ENODEV;
 	}
 
-	counter_inc(net->stats.handover.failed);
+	osmo_counter_inc(net->stats.handover.failed);
 
 	osmo_timer_del(&ho->T3103);
 	llist_del(&ho->list);
diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c
index 324104f..2dcd3b4 100644
--- a/openbsc/src/libbsc/paging.c
+++ b/openbsc/src/libbsc/paging.c
@@ -262,7 +262,7 @@ static void paging_T3113_expired(void *data)
 		req, req->subscr->imsi);
 
 	/* must be destroyed before calling cbfn, to prevent double free */
-	counter_inc(req->bts->network->stats.paging.expired);
+	osmo_counter_inc(req->bts->network->stats.paging.expired);
 	cbfn_param = req->cbfn_param;
 	cbfn = req->cbfn;
 
@@ -311,7 +311,7 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
 	struct gsm_bts *bts = NULL;
 	int num_pages = 0;
 
-	counter_inc(network->stats.paging.attempted);
+	osmo_counter_inc(network->stats.paging.attempted);
 
 	/* start paging subscriber on all BTS within Location Area */
 	do {
@@ -337,7 +337,7 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
 	} while (1);
 
 	if (num_pages == 0)
-		counter_inc(network->stats.paging.detached);
+		osmo_counter_inc(network->stats.paging.detached);
 
 	return num_pages;
 }
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index 5437548..45e56af 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -290,36 +290,36 @@ struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_cod
 	INIT_LLIST_HEAD(&net->upqueue);
 	INIT_LLIST_HEAD(&net->bts_list);
 
-	net->stats.chreq.total = counter_alloc("net.chreq.total");
-	net->stats.chreq.no_channel = counter_alloc("net.chreq.no_channel");
-	net->stats.handover.attempted = counter_alloc("net.handover.attempted");
-	net->stats.handover.no_channel = counter_alloc("net.handover.no_channel");
-	net->stats.handover.timeout = counter_alloc("net.handover.timeout");
-	net->stats.handover.completed = counter_alloc("net.handover.completed");
-	net->stats.handover.failed = counter_alloc("net.handover.failed");
-	net->stats.loc_upd_type.attach = counter_alloc("net.loc_upd_type.attach");
-	net->stats.loc_upd_type.normal = counter_alloc("net.loc_upd_type.normal");
-	net->stats.loc_upd_type.periodic = counter_alloc("net.loc_upd_type.periodic");
-	net->stats.loc_upd_type.detach = counter_alloc("net.imsi_detach.count");
-	net->stats.loc_upd_resp.reject = counter_alloc("net.loc_upd_resp.reject");
-	net->stats.loc_upd_resp.accept = counter_alloc("net.loc_upd_resp.accept");
-	net->stats.paging.attempted = counter_alloc("net.paging.attempted");
-	net->stats.paging.detached = counter_alloc("net.paging.detached");
-	net->stats.paging.completed = counter_alloc("net.paging.completed");
-	net->stats.paging.expired = counter_alloc("net.paging.expired");
-	net->stats.sms.submitted = counter_alloc("net.sms.submitted");
-	net->stats.sms.no_receiver = counter_alloc("net.sms.no_receiver");
-	net->stats.sms.delivered = counter_alloc("net.sms.delivered");
-	net->stats.sms.rp_err_mem = counter_alloc("net.sms.rp_err_mem");
-	net->stats.sms.rp_err_other = counter_alloc("net.sms.rp_err_other");
-	net->stats.call.mo_setup = counter_alloc("net.call.mo_setup");
-	net->stats.call.mo_connect_ack = counter_alloc("net.call.mo_connect_ack");
-	net->stats.call.mt_setup = counter_alloc("net.call.mt_setup");
-	net->stats.call.mt_connect = counter_alloc("net.call.mt_connect");
-	net->stats.chan.rf_fail = counter_alloc("net.chan.rf_fail");
-	net->stats.chan.rll_err = counter_alloc("net.chan.rll_err");
-	net->stats.bts.oml_fail = counter_alloc("net.bts.oml_fail");
-	net->stats.bts.rsl_fail = counter_alloc("net.bts.rsl_fail");
+	net->stats.chreq.total = osmo_counter_alloc("net.chreq.total");
+	net->stats.chreq.no_channel = osmo_counter_alloc("net.chreq.no_channel");
+	net->stats.handover.attempted = osmo_counter_alloc("net.handover.attempted");
+	net->stats.handover.no_channel = osmo_counter_alloc("net.handover.no_channel");
+	net->stats.handover.timeout = osmo_counter_alloc("net.handover.timeout");
+	net->stats.handover.completed = osmo_counter_alloc("net.handover.completed");
+	net->stats.handover.failed = osmo_counter_alloc("net.handover.failed");
+	net->stats.loc_upd_type.attach = osmo_counter_alloc("net.loc_upd_type.attach");
+	net->stats.loc_upd_type.normal = osmo_counter_alloc("net.loc_upd_type.normal");
+	net->stats.loc_upd_type.periodic = osmo_counter_alloc("net.loc_upd_type.periodic");
+	net->stats.loc_upd_type.detach = osmo_counter_alloc("net.imsi_detach.count");
+	net->stats.loc_upd_resp.reject = osmo_counter_alloc("net.loc_upd_resp.reject");
+	net->stats.loc_upd_resp.accept = osmo_counter_alloc("net.loc_upd_resp.accept");
+	net->stats.paging.attempted = osmo_counter_alloc("net.paging.attempted");
+	net->stats.paging.detached = osmo_counter_alloc("net.paging.detached");
+	net->stats.paging.completed = osmo_counter_alloc("net.paging.completed");
+	net->stats.paging.expired = osmo_counter_alloc("net.paging.expired");
+	net->stats.sms.submitted = osmo_counter_alloc("net.sms.submitted");
+	net->stats.sms.no_receiver = osmo_counter_alloc("net.sms.no_receiver");
+	net->stats.sms.delivered = osmo_counter_alloc("net.sms.delivered");
+	net->stats.sms.rp_err_mem = osmo_counter_alloc("net.sms.rp_err_mem");
+	net->stats.sms.rp_err_other = osmo_counter_alloc("net.sms.rp_err_other");
+	net->stats.call.mo_setup = osmo_counter_alloc("net.call.mo_setup");
+	net->stats.call.mo_connect_ack = osmo_counter_alloc("net.call.mo_connect_ack");
+	net->stats.call.mt_setup = osmo_counter_alloc("net.call.mt_setup");
+	net->stats.call.mt_connect = osmo_counter_alloc("net.call.mt_connect");
+	net->stats.chan.rf_fail = osmo_counter_alloc("net.chan.rf_fail");
+	net->stats.chan.rll_err = osmo_counter_alloc("net.chan.rll_err");
+	net->stats.bts.oml_fail = osmo_counter_alloc("net.bts.oml_fail");
+	net->stats.bts.rsl_fail = osmo_counter_alloc("net.bts.rsl_fail");
 
 	net->mncc_recv = mncc_recv;
 
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index f08fb79..d25bc21 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -1242,7 +1242,7 @@ int db_apdu_blob_store(struct gsm_subscriber *subscr,
 	return 0;
 }
 
-int db_store_counter(struct counter *ctr)
+int db_store_counter(struct osmo_counter *ctr)
 {
 	dbi_result result;
 	char *q_name;
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 153c1e5..6486b19 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -361,7 +361,7 @@ int gsm0408_loc_upd_rej(struct gsm_subscriber_connection *conn, uint8_t cause)
 	struct gsm_bts *bts = conn->bts;
 	struct msgb *msg;
 
-	counter_inc(bts->network->stats.loc_upd_resp.reject);
+	osmo_counter_inc(bts->network->stats.loc_upd_resp.reject);
 
 	msg = gsm48_create_loc_upd_rej(cause);
 	if (!msg) {
@@ -403,7 +403,7 @@ int gsm0408_loc_upd_acc(struct gsm_subscriber_connection *conn, uint32_t tmsi)
 
 	DEBUGP(DMM, "-> LOCATION UPDATE ACCEPT\n");
 
-	counter_inc(bts->network->stats.loc_upd_resp.accept);
+	osmo_counter_inc(bts->network->stats.loc_upd_resp.accept);
 
 	return gsm48_conn_sendmsg(msg, conn, NULL);
 }
@@ -524,13 +524,13 @@ static int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb
 
 	switch (lu->type) {
 	case GSM48_LUPD_NORMAL:
-		counter_inc(bts->network->stats.loc_upd_type.normal);
+		osmo_counter_inc(bts->network->stats.loc_upd_type.normal);
 		break;
 	case GSM48_LUPD_IMSI_ATT:
-		counter_inc(bts->network->stats.loc_upd_type.attach);
+		osmo_counter_inc(bts->network->stats.loc_upd_type.attach);
 		break;
 	case GSM48_LUPD_PERIODIC:
-		counter_inc(bts->network->stats.loc_upd_type.periodic);
+		osmo_counter_inc(bts->network->stats.loc_upd_type.periodic);
 		break;
 	}
 
@@ -886,7 +886,7 @@ static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg)
 	DEBUGP(DMM, "IMSI DETACH INDICATION: mi_type=0x%02x MI(%s): ",
 		mi_type, mi_string);
 
-	counter_inc(bts->network->stats.loc_upd_type.detach);
+	osmo_counter_inc(bts->network->stats.loc_upd_type.detach);
 
 	switch (mi_type) {
 	case GSM_MI_TYPE_TMSI:
@@ -1892,7 +1892,7 @@ static int gsm48_cc_rx_setup(struct gsm_trans *trans, struct msgb *msg)
 	     subscr_name(trans->subscr), trans->subscr->extension,
 	     setup.called.number);
 
-	counter_inc(trans->subscr->net->stats.call.mo_setup);
+	osmo_counter_inc(trans->subscr->net->stats.call.mo_setup);
 
 	/* indicate setup to MNCC */
 	mncc_recvmsg(trans->subscr->net, trans, MNCC_SETUP_IND, &setup);
@@ -1969,7 +1969,7 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
 	
 	new_cc_state(trans, GSM_CSTATE_CALL_PRESENT);
 
-	counter_inc(trans->subscr->net->stats.call.mt_setup);
+	osmo_counter_inc(trans->subscr->net->stats.call.mt_setup);
 
 	return gsm48_conn_sendmsg(msg, trans->conn, trans);
 }
@@ -2190,7 +2190,7 @@ static int gsm48_cc_rx_connect(struct gsm_trans *trans, struct msgb *msg)
 	}
 
 	new_cc_state(trans, GSM_CSTATE_CONNECT_REQUEST);
-	counter_inc(trans->subscr->net->stats.call.mt_connect);
+	osmo_counter_inc(trans->subscr->net->stats.call.mt_connect);
 
 	return mncc_recvmsg(trans->subscr->net, trans, MNCC_SETUP_CNF, &connect);
 }
@@ -2203,7 +2203,7 @@ static int gsm48_cc_rx_connect_ack(struct gsm_trans *trans, struct msgb *msg)
 	gsm48_stop_cc_timer(trans);
 
 	new_cc_state(trans, GSM_CSTATE_ACTIVE);
-	counter_inc(trans->subscr->net->stats.call.mo_connect_ack);
+	osmo_counter_inc(trans->subscr->net->stats.call.mo_connect_ack);
 	
 	memset(&connect_ack, 0, sizeof(struct gsm_mncc));
 	connect_ack.callref = trans->callref;
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index 326c2b8..5069be7 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -560,7 +560,7 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
 	uint8_t address_lv[12]; /* according to 03.40 / 9.1.2.5 */
 	int rc = 0;
 
-	counter_inc(conn->bts->network->stats.sms.submitted);
+	osmo_counter_inc(conn->bts->network->stats.sms.submitted);
 
 	gsms = sms_alloc();
 	if (!gsms)
@@ -656,7 +656,7 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
 	gsms->receiver = subscr_get_by_extension(conn->bts->network, gsms->dest_addr);
 	if (!gsms->receiver) {
 		rc = 1; /* cause 1: unknown subscriber */
-		counter_inc(conn->bts->network->stats.sms.no_receiver);
+		osmo_counter_inc(conn->bts->network->stats.sms.no_receiver);
 		goto out;
 	}
 
@@ -846,10 +846,10 @@ static int gsm411_rx_rp_error(struct msgb *msg, struct gsm_trans *trans,
 		 * to store this in our database and wait for a SMMA message */
 		/* FIXME */
 		send_signal(S_SMS_MEM_EXCEEDED, trans, sms, 0);
-		counter_inc(net->stats.sms.rp_err_mem);
+		osmo_counter_inc(net->stats.sms.rp_err_mem);
 	} else {
 		send_signal(S_SMS_UNKNOWN_ERROR, trans, sms, 0);
-		counter_inc(net->stats.sms.rp_err_other);
+		osmo_counter_inc(net->stats.sms.rp_err_other);
 	}
 
 	sms_free(sms);
@@ -1139,7 +1139,7 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms)
 
 	DEBUGP(DSMS, "TX: SMS DELIVER\n");
 
-	counter_inc(conn->bts->network->stats.sms.delivered);
+	osmo_counter_inc(conn->bts->network->stats.sms.delivered);
 	db_sms_inc_deliver_attempts(trans->sms.sms);
 
 	return gsm411_rp_sendmsg(msg, trans, GSM411_MT_RP_DATA_MT, msg_ref);
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 1d0097a..f751555 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -673,37 +673,37 @@ DEFUN(show_stats,
 
 	openbsc_vty_print_statistics(vty, net);
 	vty_out(vty, "Channel Requests        : %lu total, %lu no channel%s",
-		counter_get(net->stats.chreq.total),
-		counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
+		osmo_counter_get(net->stats.chreq.total),
+		osmo_counter_get(net->stats.chreq.no_channel), VTY_NEWLINE);
 	vty_out(vty, "Location Update         : %lu attach, %lu normal, %lu periodic%s",
-		counter_get(net->stats.loc_upd_type.attach),
-		counter_get(net->stats.loc_upd_type.normal),
-		counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
+		osmo_counter_get(net->stats.loc_upd_type.attach),
+		osmo_counter_get(net->stats.loc_upd_type.normal),
+		osmo_counter_get(net->stats.loc_upd_type.periodic), VTY_NEWLINE);
 	vty_out(vty, "IMSI Detach Indications : %lu%s",
-		counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
+		osmo_counter_get(net->stats.loc_upd_type.detach), VTY_NEWLINE);
 	vty_out(vty, "Location Update Response: %lu accept, %lu reject%s",
-		counter_get(net->stats.loc_upd_resp.accept),
-		counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
+		osmo_counter_get(net->stats.loc_upd_resp.accept),
+		osmo_counter_get(net->stats.loc_upd_resp.reject), VTY_NEWLINE);
 	vty_out(vty, "Handover                : %lu attempted, %lu no_channel, %lu timeout, "
 		"%lu completed, %lu failed%s",
-		counter_get(net->stats.handover.attempted),
-		counter_get(net->stats.handover.no_channel),
-		counter_get(net->stats.handover.timeout),
-		counter_get(net->stats.handover.completed),
-		counter_get(net->stats.handover.failed), VTY_NEWLINE);
+		osmo_counter_get(net->stats.handover.attempted),
+		osmo_counter_get(net->stats.handover.no_channel),
+		osmo_counter_get(net->stats.handover.timeout),
+		osmo_counter_get(net->stats.handover.completed),
+		osmo_counter_get(net->stats.handover.failed), VTY_NEWLINE);
 	vty_out(vty, "SMS MO                  : %lu submitted, %lu no receiver%s",
-		counter_get(net->stats.sms.submitted),
-		counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
+		osmo_counter_get(net->stats.sms.submitted),
+		osmo_counter_get(net->stats.sms.no_receiver), VTY_NEWLINE);
 	vty_out(vty, "SMS MT                  : %lu delivered, %lu no memory, %lu other error%s",
-		counter_get(net->stats.sms.delivered),
-		counter_get(net->stats.sms.rp_err_mem),
-		counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
+		osmo_counter_get(net->stats.sms.delivered),
+		osmo_counter_get(net->stats.sms.rp_err_mem),
+		osmo_counter_get(net->stats.sms.rp_err_other), VTY_NEWLINE);
 	vty_out(vty, "MO Calls                : %lu setup, %lu connect ack%s",
-		counter_get(net->stats.call.mo_setup),
-		counter_get(net->stats.call.mo_connect_ack), VTY_NEWLINE);
+		osmo_counter_get(net->stats.call.mo_setup),
+		osmo_counter_get(net->stats.call.mo_connect_ack), VTY_NEWLINE);
 	vty_out(vty, "MT Calls                : %lu setup, %lu connect%s",
-		counter_get(net->stats.call.mt_setup),
-		counter_get(net->stats.call.mt_connect), VTY_NEWLINE);
+		osmo_counter_get(net->stats.call.mt_setup),
+		osmo_counter_get(net->stats.call.mt_connect), VTY_NEWLINE);
 	return CMD_SUCCESS;
 }
 
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index f732488..5df4cd8 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -663,7 +663,7 @@ static int forward_sccp_to_bts(struct bsc_msc_connection *msc_con, struct msgb *
 		case SCCP_MSG_TYPE_IT:
 			con = patch_sccp_src_ref_to_bsc(msg, parsed, nat);
 			if (parsed->gsm_type == BSS_MAP_MSG_ASSIGMENT_RQST) {
-				counter_inc(nat->stats.sccp.calls);
+				osmo_counter_inc(nat->stats.sccp.calls);
 
 				if (con) {
 					struct rate_ctr_group *ctrg;
@@ -752,7 +752,7 @@ static void msc_connection_was_lost(struct bsc_msc_connection *con)
 
 static void msc_connection_connected(struct bsc_msc_connection *con)
 {
-	counter_inc(nat->stats.msc.reconn);
+	osmo_counter_inc(nat->stats.msc.reconn);
 }
 
 static void msc_send_reset(struct bsc_msc_connection *msc_con)
@@ -1211,7 +1211,7 @@ static int ipaccess_listen_bsc_cb(struct osmo_fd *bfd, unsigned int what)
 	}
 
 	/* count the reconnect */
-	counter_inc(nat->stats.bsc.reconn);
+	osmo_counter_inc(nat->stats.bsc.reconn);
 
 	/*
 	 * if we are not connected to a msc... just close the socket
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 4f90cdf..8765f27 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -95,12 +95,12 @@ struct bsc_nat *bsc_nat_alloc(void)
 	INIT_LLIST_HEAD(&nat->access_lists);
 	INIT_LLIST_HEAD(&nat->dests);
 
-	nat->stats.sccp.conn = counter_alloc("nat.sccp.conn");
-	nat->stats.sccp.calls = counter_alloc("nat.sccp.calls");
-	nat->stats.bsc.reconn = counter_alloc("nat.bsc.conn");
-	nat->stats.bsc.auth_fail = counter_alloc("nat.bsc.auth_fail");
-	nat->stats.msc.reconn = counter_alloc("nat.msc.conn");
-	nat->stats.ussd.reconn = counter_alloc("nat.ussd.conn");
+	nat->stats.sccp.conn = osmo_counter_alloc("nat.sccp.conn");
+	nat->stats.sccp.calls = osmo_counter_alloc("nat.sccp.calls");
+	nat->stats.bsc.reconn = osmo_counter_alloc("nat.bsc.conn");
+	nat->stats.bsc.auth_fail = osmo_counter_alloc("nat.bsc.auth_fail");
+	nat->stats.msc.reconn = osmo_counter_alloc("nat.msc.conn");
+	nat->stats.ussd.reconn = osmo_counter_alloc("nat.ussd.conn");
 	nat->auth_timeout = 2;
 	nat->ping_timeout = 20;
 	nat->pong_timeout = 5;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
index b892d7a..a115fad 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
@@ -250,15 +250,15 @@ static void dump_stat_total(struct vty *vty, struct bsc_nat *nat)
 {
 	vty_out(vty, "NAT statistics%s", VTY_NEWLINE);
 	vty_out(vty, " SCCP Connections %lu total, %lu calls%s",
-		counter_get(nat->stats.sccp.conn),
-		counter_get(nat->stats.sccp.calls), VTY_NEWLINE);
+		osmo_counter_get(nat->stats.sccp.conn),
+		osmo_counter_get(nat->stats.sccp.calls), VTY_NEWLINE);
 	vty_out(vty, " MSC Connections %lu%s",
-		counter_get(nat->stats.msc.reconn), VTY_NEWLINE);
+		osmo_counter_get(nat->stats.msc.reconn), VTY_NEWLINE);
 	vty_out(vty, " MSC Connected: %d%s",
 		nat->msc_con->is_connected, VTY_NEWLINE);
 	vty_out(vty, " BSC Connections %lu total, %lu auth failed.%s",
-		counter_get(nat->stats.bsc.reconn),
-		counter_get(nat->stats.bsc.auth_fail), VTY_NEWLINE);
+		osmo_counter_get(nat->stats.bsc.reconn),
+		osmo_counter_get(nat->stats.bsc.auth_fail), VTY_NEWLINE);
 }
 
 static void dump_stat_bsc(struct vty *vty, struct bsc_config *conf)
diff --git a/openbsc/src/osmo-bsc_nat/bsc_sccp.c b/openbsc/src/osmo-bsc_nat/bsc_sccp.c
index f7d868a..de6b421 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_sccp.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_sccp.c
@@ -129,7 +129,7 @@ struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc,
 	bsc_mgcp_init(conn);
 	llist_add_tail(&conn->list_entry, &bsc->nat->sccp_connections);
 	rate_ctr_inc(&bsc->cfg->stats.ctrg->ctr[BCFG_CTR_SCCP_CONN]);
-	counter_inc(bsc->cfg->nat->stats.sccp.conn);
+	osmo_counter_inc(bsc->cfg->nat->stats.sccp.conn);
 
 	LOGP(DNAT, LOGL_DEBUG, "Created 0x%x <-> 0x%x mapping for con %p\n",
 	     sccp_src_ref_to_int(&conn->real_ref),
diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
index 69cb7a4..a6fcffc 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
@@ -209,7 +209,7 @@ static int ussd_listen_cb(struct osmo_fd *bfd, unsigned int what)
 	}
 
 	nat = (struct bsc_nat *) bfd->data;
-	counter_inc(nat->stats.ussd.reconn);
+	osmo_counter_inc(nat->stats.ussd.reconn);
 
 	conn = bsc_nat_ussd_alloc(nat);
 	if (!conn) {
diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c
index 8e987b2..5e60441 100644
--- a/openbsc/src/osmo-nitb/bsc_hack.c
+++ b/openbsc/src/osmo-nitb/bsc_hack.c
@@ -195,7 +195,7 @@ static void signal_handler(int signal)
 }
 
 /* timer handling */
-static int _db_store_counter(struct counter *counter, void *data)
+static int _db_store_counter(struct osmo_counter *counter, void *data)
 {
 	return db_store_counter(counter);
 }
@@ -203,7 +203,7 @@ static int _db_store_counter(struct counter *counter, void *data)
 static void db_sync_timer_cb(void *data)
 {
 	/* store counters to database and re-schedule */
-	counters_for_each(_db_store_counter, NULL);
+	osmo_counters_for_each(_db_store_counter, NULL);
 	osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL);
 }
 
diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c
index 9cb6897..6e82126 100644
--- a/openbsc/src/utils/bs11_config.c
+++ b/openbsc/src/utils/bs11_config.c
@@ -72,7 +72,7 @@ static const uint8_t too_fast[] = { 0x12, 0x80, 0x00, 0x00, 0x02, 0x02 };
 static struct log_target *stderr_target;
 
 /* dummy function to keep gsm_data.c happy */
-struct counter *counter_alloc(const char *name)
+struct osmo_counter *osmo_counter_alloc(const char *name)
 {
 	return NULL;
 }
-- 
1.7.2.3





More information about the OpenBSC mailing list