[PATCH 4/5] src: use namespace prefix osmo_wqueue*

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:27 UTC 2011


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

Summary of changes:

s/struct write_queue/struct osmo_wqueue/g
s/write_queue_init/osmo_wqueue_init/g
s/write_queue_clear/osmo_wqueue_clear/g
s/write_queue_enqueue/osmo_wqueue_enqueue/g
s/write_queue_bfd_cb/osmo_wqueue_bfd_cb/g
---
 openbsc/include/openbsc/bsc_msc.h         |    2 +-
 openbsc/include/openbsc/bsc_nat.h         |    8 ++++----
 openbsc/include/openbsc/mgcp.h            |    2 +-
 openbsc/include/openbsc/osmo_bsc_rf.h     |    2 +-
 openbsc/include/openbsc/osmo_msc_data.h   |    2 +-
 openbsc/src/libbsc/bsc_msc.c              |   14 +++++++-------
 openbsc/src/osmo-bsc/osmo_bsc_msc.c       |    6 +++---
 openbsc/src/osmo-bsc/osmo_bsc_rf.c        |    6 +++---
 openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c |    6 +++---
 openbsc/src/osmo-bsc_nat/bsc_nat.c        |    4 ++--
 openbsc/src/osmo-bsc_nat/bsc_nat_utils.c  |    8 ++++----
 openbsc/src/osmo-bsc_nat/bsc_ussd.c       |    4 ++--
 12 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/openbsc/include/openbsc/bsc_msc.h b/openbsc/include/openbsc/bsc_msc.h
index 88f0de4..9543002 100644
--- a/openbsc/include/openbsc/bsc_msc.h
+++ b/openbsc/include/openbsc/bsc_msc.h
@@ -35,7 +35,7 @@ struct bsc_msc_dest {
 
 
 struct bsc_msc_connection {
-	struct write_queue write_queue;
+	struct osmo_wqueue write_queue;
 	int is_connected;
 	int is_authenticated;
 	int first_contact;
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 73911bc..52b2ce5 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -76,7 +76,7 @@ struct bsc_connection {
 	int authenticated;
 
 	/* the fd we use to communicate */
-	struct write_queue write_queue;
+	struct osmo_wqueue write_queue;
 
 	/* the BSS associated */
 	struct bsc_config *cfg;
@@ -286,7 +286,7 @@ struct bsc_nat {
 };
 
 struct bsc_nat_ussd_con {
-	struct write_queue queue;
+	struct osmo_wqueue queue;
 	struct bsc_nat *nat;
 	int authorized;
 
@@ -361,8 +361,8 @@ uint32_t bsc_mgcp_extract_ci(const char *resp);
 
 
 int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
-int bsc_do_write(struct write_queue *queue, struct msgb *msg, int id);
-int bsc_write_msg(struct write_queue *queue, struct msgb *msg);
+int bsc_do_write(struct osmo_wqueue *queue, struct msgb *msg, int id);
+int bsc_write_msg(struct osmo_wqueue *queue, struct msgb *msg);
 int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg);
 
 /* IMSI allow/deny handling */
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index 3d8e711..b9f8116 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -135,7 +135,7 @@ struct mgcp_config {
 	struct in_addr transcoder_in;
 	int transcoder_remote_base;
 
-	struct write_queue gw_fd;
+	struct osmo_wqueue gw_fd;
 
 	struct mgcp_port_range bts_ports;
 	struct mgcp_port_range net_ports;
diff --git a/openbsc/include/openbsc/osmo_bsc_rf.h b/openbsc/include/openbsc/osmo_bsc_rf.h
index dbbb3db..6db28cd 100644
--- a/openbsc/include/openbsc/osmo_bsc_rf.h
+++ b/openbsc/include/openbsc/osmo_bsc_rf.h
@@ -26,7 +26,7 @@ struct osmo_bsc_rf {
 };
 
 struct osmo_bsc_rf_conn {
-	struct write_queue queue;
+	struct osmo_wqueue queue;
 	struct osmo_bsc_rf *rf;
 };
 
diff --git a/openbsc/include/openbsc/osmo_msc_data.h b/openbsc/include/openbsc/osmo_msc_data.h
index 495c923..3212b36 100644
--- a/openbsc/include/openbsc/osmo_msc_data.h
+++ b/openbsc/include/openbsc/osmo_msc_data.h
@@ -59,7 +59,7 @@ struct osmo_msc_data {
 
 
 	/* mgcp agent */
-	struct write_queue mgcp_agent;
+	struct osmo_wqueue mgcp_agent;
 
 	/* rf ctl related bits */
 	char *mid_call_txt;
diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c
index a46f4b9..e9ffce3 100644
--- a/openbsc/src/libbsc/bsc_msc.c
+++ b/openbsc/src/libbsc/bsc_msc.c
@@ -42,7 +42,7 @@ static void connection_loss(struct bsc_msc_connection *con)
 
 	close(fd->fd);
 	fd->fd = -1;
-	fd->cb = write_queue_bfd_cb;
+	fd->cb = osmo_wqueue_bfd_cb;
 	fd->when = 0;
 
 	con->is_connected = 0;
@@ -64,7 +64,7 @@ static int msc_connection_connect(struct osmo_fd *fd, unsigned int what)
 	int rc;
 	int val;
 	struct bsc_msc_connection *con;
-	struct write_queue *queue;
+	struct osmo_wqueue *queue;
 
 	socklen_t len = sizeof(val);
 
@@ -73,7 +73,7 @@ static int msc_connection_connect(struct osmo_fd *fd, unsigned int what)
 		return -1;
 	}
 
-	queue = container_of(fd, struct write_queue, bfd);
+	queue = container_of(fd, struct osmo_wqueue, bfd);
 	con = container_of(queue, struct bsc_msc_connection, write_queue);
 
 	/* From here on we will either be connected or reconnect */
@@ -92,7 +92,7 @@ static int msc_connection_connect(struct osmo_fd *fd, unsigned int what)
 
 
 	/* go to full operation */
-	fd->cb = write_queue_bfd_cb;
+	fd->cb = osmo_wqueue_bfd_cb;
 	fd->when = BSC_FD_READ | BSC_FD_EXCEPT;
 
 	con->is_connected = 1;
@@ -191,7 +191,7 @@ int bsc_msc_connect(struct bsc_msc_connection *con)
 		return ret;
 	} else {
 		fd->when = BSC_FD_READ | BSC_FD_EXCEPT;
-		fd->cb = write_queue_bfd_cb;
+		fd->cb = osmo_wqueue_bfd_cb;
 		con->is_connected = 1;
 		if (con->connected)
 			con->connected(con);
@@ -219,13 +219,13 @@ struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dests)
 
 	con->dests = dests;
 	con->write_queue.bfd.fd = -1;
-	write_queue_init(&con->write_queue, 100);
+	osmo_wqueue_init(&con->write_queue, 100);
 	return con;
 }
 
 void bsc_msc_lost(struct bsc_msc_connection *con)
 {
-	write_queue_clear(&con->write_queue);
+	osmo_wqueue_clear(&con->write_queue);
 	osmo_timer_del(&con->timeout_timer);
 
 	if (con->write_queue.bfd.fd >= 0)
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index b4feded..6ea8c4f 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -102,7 +102,7 @@ static void mgcp_forward(struct osmo_msc_data *data, struct msgb *msg)
 
 	msgb_put(mgcp, msgb_l2len(msg));
 	memcpy(mgcp->data, msg->l2h, mgcp->len);
-	if (write_queue_enqueue(&data->mgcp_agent, mgcp) != 0) {
+	if (osmo_wqueue_enqueue(&data->mgcp_agent, mgcp) != 0) {
 		LOGP(DMGCP, LOGL_FATAL, "Could not queue message to MGCP GW.\n");
 		msgb_free(mgcp);
 	}
@@ -144,7 +144,7 @@ static int mgcp_create_port(struct osmo_msc_data *data)
 		return -1;
 	}
 
-	write_queue_init(&data->mgcp_agent, 10);
+	osmo_wqueue_init(&data->mgcp_agent, 10);
 	data->mgcp_agent.bfd.when = BSC_FD_READ;
 	data->mgcp_agent.bfd.data = data;
 	data->mgcp_agent.read_cb = mgcp_do_read;
@@ -166,7 +166,7 @@ static int mgcp_create_port(struct osmo_msc_data *data)
 int msc_queue_write(struct bsc_msc_connection *conn, struct msgb *msg, int proto)
 {
 	ipaccess_prepend_header(msg, proto);
-	if (write_queue_enqueue(&conn->write_queue, msg) != 0) {
+	if (osmo_wqueue_enqueue(&conn->write_queue, msg) != 0) {
 		LOGP(DMSC, LOGL_FATAL, "Failed to queue IPA/%d\n", proto);
 		msgb_free(msg);
 		return -1;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_rf.c b/openbsc/src/osmo-bsc/osmo_bsc_rf.c
index 78550d7..11cdffe 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_rf.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_rf.c
@@ -69,7 +69,7 @@ static void send_resp(struct osmo_bsc_rf_conn *conn, char send)
 	msg->l2h = msgb_put(msg, 1);
 	msg->l2h[0] = send;
 
-	if (write_queue_enqueue(&conn->queue, msg) != 0) {
+	if (osmo_wqueue_enqueue(&conn->queue, msg) != 0) {
 		LOGP(DINP, LOGL_ERROR, "Failed to enqueue the answer.\n");
 		msgb_free(msg);
 		return;
@@ -205,7 +205,7 @@ static int rf_read_cmd(struct osmo_fd *fd)
 		LOGP(DINP, LOGL_ERROR, "Short read %d/%s\n", errno, strerror(errno));
 		osmo_fd_unregister(fd);
 		close(fd->fd);
-		write_queue_clear(&conn->queue);
+		osmo_wqueue_clear(&conn->queue);
 		talloc_free(conn);
 		return -1;
 	}
@@ -265,7 +265,7 @@ static int rf_ctl_accept(struct osmo_fd *bfd, unsigned int what)
 		return -1;
 	}
 
-	write_queue_init(&conn->queue, 10);
+	osmo_wqueue_init(&conn->queue, 10);
 	conn->queue.bfd.data = conn;
 	conn->queue.bfd.fd = fd;
 	conn->queue.bfd.when = BSC_FD_READ | BSC_FD_WRITE;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index be2666d..9ac54da 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -478,7 +478,7 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg)
 		return;
 	}
 
-	if (write_queue_enqueue(&bsc->nat->mgcp_cfg->gw_fd, output) != 0) {
+	if (osmo_wqueue_enqueue(&bsc->nat->mgcp_cfg->gw_fd, output) != 0) {
 		LOGP(DMGCP, LOGL_ERROR, "Failed to queue MGCP msg.\n");
 		msgb_free(output);
 	}
@@ -628,7 +628,7 @@ static int mgcp_do_read(struct osmo_fd *fd)
 
 	/* we do have a direct answer... e.g. AUEP */
 	if (resp) {
-		if (write_queue_enqueue(&nat->mgcp_cfg->gw_fd, resp) != 0) {
+		if (osmo_wqueue_enqueue(&nat->mgcp_cfg->gw_fd, resp) != 0) {
 			LOGP(DMGCP, LOGL_ERROR, "Failed to enqueue msg.\n");
 			msgb_free(resp);
 		}
@@ -698,7 +698,7 @@ int bsc_mgcp_nat_init(struct bsc_nat *nat)
 		return -1;
 	}
 
-	write_queue_init(&cfg->gw_fd, 10);
+	osmo_wqueue_init(&cfg->gw_fd, 10);
 	cfg->gw_fd.bfd.when = BSC_FD_READ;
 	cfg->gw_fd.bfd.data = nat;
 	cfg->gw_fd.read_cb = mgcp_do_read;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 0fb5843..f732488 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -100,7 +100,7 @@ static void queue_for_msc(struct bsc_msc_connection *con, struct msgb *msg)
 	}
 
 
-	if (write_queue_enqueue(&con->write_queue, msg) != 0) {
+	if (osmo_wqueue_enqueue(&con->write_queue, msg) != 0) {
 		LOGP(DINP, LOGL_ERROR, "Failed to enqueue the write.\n");
 		msgb_free(msg);
 	}
@@ -877,7 +877,7 @@ void bsc_close_connection(struct bsc_connection *connection)
 
 	osmo_fd_unregister(&connection->write_queue.bfd);
 	close(connection->write_queue.bfd.fd);
-	write_queue_clear(&connection->write_queue);
+	osmo_wqueue_clear(&connection->write_queue);
 	llist_del(&connection->list_entry);
 
 	talloc_free(connection);
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index e796b2b..4f90cdf 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -124,7 +124,7 @@ struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat)
 		return NULL;
 
 	con->nat = nat;
-	write_queue_init(&con->write_queue, 100);
+	osmo_wqueue_init(&con->write_queue, 100);
 	return con;
 }
 
@@ -335,16 +335,16 @@ int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int proto)
 	return bsc_do_write(&bsc->write_queue, msg, proto);
 }
 
-int bsc_do_write(struct write_queue *queue, struct msgb *msg, int proto)
+int bsc_do_write(struct osmo_wqueue *queue, struct msgb *msg, int proto)
 {
 	/* prepend the header */
 	ipaccess_prepend_header(msg, proto);
 	return bsc_write_msg(queue, msg);
 }
 
-int bsc_write_msg(struct write_queue *queue, struct msgb *msg)
+int bsc_write_msg(struct osmo_wqueue *queue, struct msgb *msg)
 {
-	if (write_queue_enqueue(queue, msg) != 0) {
+	if (osmo_wqueue_enqueue(queue, msg) != 0) {
 		LOGP(DINP, LOGL_ERROR, "Failed to enqueue the write.\n");
 		msgb_free(msg);
 		return -1;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
index 910ef40..69cb7a4 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
@@ -60,7 +60,7 @@ static void bsc_nat_ussd_destroy(struct bsc_nat_ussd_con *con)
 	close(con->queue.bfd.fd);
 	osmo_fd_unregister(&con->queue.bfd);
 	osmo_timer_del(&con->auth_timeout);
-	write_queue_clear(&con->queue);
+	osmo_wqueue_clear(&con->queue);
 	talloc_free(con);
 }
 
@@ -218,7 +218,7 @@ static int ussd_listen_cb(struct osmo_fd *bfd, unsigned int what)
 		return -1;
 	}
 
-	write_queue_init(&conn->queue, 10);
+	osmo_wqueue_init(&conn->queue, 10);
 	conn->queue.bfd.data = conn;
 	conn->queue.bfd.fd = fd;
 	conn->queue.bfd.when = BSC_FD_READ;
-- 
1.7.2.3





More information about the OpenBSC mailing list