[PATCH 2/6] src: use namespace prefix osmo_fd* and osmo_select*

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/baseband-devel@lists.osmocom.org/.

pablo at gnumonks.org pablo at gnumonks.org
Sun May 15 13:14:22 UTC 2011


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

Summary of changes:

s/struct bsc_fd/struct osmo_fd/g
s/bsc_register_fd/osmo_fd_register/g
s/bsc_unregister_fd/osmo_fd_unregister/g
s/bsc_select_main/osmo_select_main/g
---
 src/host/layer23/src/common/gps.c            |   14 +++++++-------
 src/host/layer23/src/common/l1l2_interface.c |    8 ++++----
 src/host/layer23/src/common/main.c           |    2 +-
 src/host/layer23/src/common/sap_interface.c  |    8 ++++----
 src/host/layer23/src/mobile/main.c           |    2 +-
 src/host/osmocon/osmocon.c                   |   24 ++++++++++++------------
 src/host/osmocon/osmoload.c                  |   10 +++++-----
 7 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/host/layer23/src/common/gps.c b/src/host/layer23/src/common/gps.c
index dba93fb..38aae2c 100644
--- a/src/host/layer23/src/common/gps.c
+++ b/src/host/layer23/src/common/gps.c
@@ -52,13 +52,13 @@ struct osmo_gps g = {
 	0,0
 };
 
-static struct bsc_fd gps_bfd;
+static struct osmo_fd gps_bfd;
 
 #ifdef _HAVE_GPSD
 
 static struct gps_data_t* gdata;
 
-int osmo_gpsd_cb(struct bsc_fd *bfd, unsigned int what)
+int osmo_gpsd_cb(struct osmo_fd *bfd, unsigned int what)
 {
 	struct tm *tm;
 	unsigned diff = 0;
@@ -125,7 +125,7 @@ int osmo_gpsd_open(void)
 		return -1;
 	}
 
-	bsc_register_fd(&gps_bfd);
+	osmo_fd_register(&gps_bfd);
 
 	return 0;
 }
@@ -137,7 +137,7 @@ void osmo_gpsd_close(void)
 
 	LOGP(DGPS, LOGL_INFO, "Disconnecting from gpsd\n");
 
-	bsc_unregister_fd(&gps_bfd);
+	osmo_fd_unregister(&gps_bfd);
 
 	gps_close(gdata);
 	gps_bfd.fd = -1; /* -1 or 0 indicates: 'close' */
@@ -242,7 +242,7 @@ static int nmea_checksum(char *line)
 	return (strtoul(line+1, NULL, 16) == checksum);
 }
 
-int osmo_serialgps_cb(struct bsc_fd *bfd, unsigned int what)
+int osmo_serialgps_cb(struct osmo_fd *bfd, unsigned int what)
 {
 	char buff[128];
 	static char line[128];
@@ -323,7 +323,7 @@ int osmo_serialgps_open(void)
 			printf("Failed to set termios for GPS\n");
 	}
 
-	bsc_register_fd(&gps_bfd);
+	osmo_fd_register(&gps_bfd);
 
 	return 0;
 }
@@ -335,7 +335,7 @@ void osmo_serialgps_close(void)
 
 	LOGP(DGPS, LOGL_INFO, "Close GPS device\n");
 
-	bsc_unregister_fd(&gps_bfd);
+	osmo_fd_unregister(&gps_bfd);
 
 	if (isatty(gps_bfd.fd))
 		tcsetattr(gps_bfd.fd, TCSANOW, &gps_old_termios);
diff --git a/src/host/layer23/src/common/l1l2_interface.c b/src/host/layer23/src/common/l1l2_interface.c
index 23e1ef2..3272359 100644
--- a/src/host/layer23/src/common/l1l2_interface.c
+++ b/src/host/layer23/src/common/l1l2_interface.c
@@ -42,7 +42,7 @@
 #define GSM_L2_LENGTH 256
 #define GSM_L2_HEADROOM 32
 
-static int layer2_read(struct bsc_fd *fd)
+static int layer2_read(struct osmo_fd *fd)
 {
 	struct msgb *msg;
 	u_int16_t len;
@@ -86,7 +86,7 @@ static int layer2_read(struct bsc_fd *fd)
 	return 0;
 }
 
-static int layer2_write(struct bsc_fd *fd, struct msgb *msg)
+static int layer2_write(struct osmo_fd *fd, struct msgb *msg)
 {
 	int rc;
 
@@ -132,7 +132,7 @@ int layer2_open(struct osmocom_ms *ms, const char *socket_path)
 	ms->l2_wq.read_cb = layer2_read;
 	ms->l2_wq.write_cb = layer2_write;
 
-	rc = bsc_register_fd(&ms->l2_wq.bfd);
+	rc = osmo_fd_register(&ms->l2_wq.bfd);
 	if (rc != 0) {
 		fprintf(stderr, "Failed to register fd.\n");
 		close(ms->l2_wq.bfd.fd);
@@ -149,7 +149,7 @@ int layer2_close(struct osmocom_ms *ms)
 
 	close(ms->l2_wq.bfd.fd);
 	ms->l2_wq.bfd.fd = -1;
-	bsc_unregister_fd(&ms->l2_wq.bfd);
+	osmo_fd_unregister(&ms->l2_wq.bfd);
 
 	return 0;
 }
diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c
index 61513ea..40e6a07 100644
--- a/src/host/layer23/src/common/main.c
+++ b/src/host/layer23/src/common/main.c
@@ -278,7 +278,7 @@ int main(int argc, char **argv)
 	while (!quit) {
 		if (l23_app_work)
 			l23_app_work(ms);
-		bsc_select_main(0);
+		osmo_select_main(0);
 	}
 
 	return 0;
diff --git a/src/host/layer23/src/common/sap_interface.c b/src/host/layer23/src/common/sap_interface.c
index 54aa635..4d465f0 100644
--- a/src/host/layer23/src/common/sap_interface.c
+++ b/src/host/layer23/src/common/sap_interface.c
@@ -42,7 +42,7 @@
 #define GSM_SAP_LENGTH 300
 #define GSM_SAP_HEADROOM 32
 
-static int sap_read(struct bsc_fd *fd)
+static int sap_read(struct osmo_fd *fd)
 {
 	struct msgb *msg;
 	u_int16_t len;
@@ -88,7 +88,7 @@ static int sap_read(struct bsc_fd *fd)
 	return 0;
 }
 
-static int sap_write(struct bsc_fd *fd, struct msgb *msg)
+static int sap_write(struct osmo_fd *fd, struct msgb *msg)
 {
 	int rc;
 
@@ -133,7 +133,7 @@ int sap_open(struct osmocom_ms *ms, const char *socket_path)
 	ms->sap_wq.read_cb = sap_read;
 	ms->sap_wq.write_cb = sap_write;
 
-	rc = bsc_register_fd(&ms->sap_wq.bfd);
+	rc = osmo_fd_register(&ms->sap_wq.bfd);
 	if (rc != 0) {
 		fprintf(stderr, "Failed to register fd.\n");
 		return rc;
@@ -149,7 +149,7 @@ int sap_close(struct osmocom_ms *ms)
 
 	close(ms->sap_wq.bfd.fd);
 	ms->sap_wq.bfd.fd = -1;
-	bsc_unregister_fd(&ms->sap_wq.bfd);
+	osmo_fd_unregister(&ms->sap_wq.bfd);
 
 	return 0;
 }
diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c
index 4765995..1f423a2 100644
--- a/src/host/layer23/src/mobile/main.c
+++ b/src/host/layer23/src/mobile/main.c
@@ -202,7 +202,7 @@ int main(int argc, char **argv)
 		l23_app_work(&quit);
 		if (quit && llist_empty(&ms_list))
 			break;
-		bsc_select_main(0);
+		osmo_select_main(0);
 	}
 
 	l23_app_exit();
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index c8ea38a..ab977c1 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -69,14 +69,14 @@ struct tool_server *tool_server_for_dlci[256];
 struct tool_connection {
 	struct tool_server *server;
 	struct llist_head entry;
-	struct bsc_fd fd;
+	struct osmo_fd fd;
 };
 
 /**
  * server for a tool
  */
 struct tool_server {
-	struct bsc_fd bfd;
+	struct osmo_fd bfd;
 	uint8_t dlci;
 	struct llist_head connections;
 };
@@ -129,7 +129,7 @@ struct dnload {
 	enum romload_state romload_state;
 	enum mtk_state mtk_state;
 	enum dnload_mode mode;
-	struct bsc_fd serial_fd;
+	struct osmo_fd serial_fd;
 	char *filename;
 	char *chainload_filename;
 
@@ -1192,7 +1192,7 @@ static int handle_read_mtk(void)
 	return nbytes;
 }
 
-static int serial_read(struct bsc_fd *fd, unsigned int flags)
+static int serial_read(struct osmo_fd *fd, unsigned int flags)
 {
 	int rc;
 	if (flags & BSC_FD_READ) {
@@ -1264,7 +1264,7 @@ static int version(const char *name)
 	exit(2);
 }
 
-static int un_tool_read(struct bsc_fd *fd, unsigned int flags)
+static int un_tool_read(struct osmo_fd *fd, unsigned int flags)
 {
 	int rc, c;
 	uint16_t length = 0xffff;
@@ -1313,14 +1313,14 @@ static int un_tool_read(struct bsc_fd *fd, unsigned int flags)
 close:
 
 	close(fd->fd);
-	bsc_unregister_fd(fd);
+	osmo_fd_unregister(fd);
 	llist_del(&con->entry);
 	talloc_free(con);
 	return -1;
 }
 
 /* accept a new connection */
-static int tool_accept(struct bsc_fd *fd, unsigned int flags)
+static int tool_accept(struct osmo_fd *fd, unsigned int flags)
 {
 	struct tool_server *srv = (struct tool_server *)fd->data;
 	struct tool_connection *con;
@@ -1347,7 +1347,7 @@ static int tool_accept(struct bsc_fd *fd, unsigned int flags)
 	con->fd.when = BSC_FD_READ;
 	con->fd.cb = un_tool_read;
 	con->fd.data = con;
-	if (bsc_register_fd(&con->fd) != 0) {
+	if (osmo_fd_register(&con->fd) != 0) {
 		fprintf(stderr, "Failed to register the fd.\n");
 		return -1;
 	}
@@ -1363,7 +1363,7 @@ static int register_tool_server(struct tool_server *ts,
 				const char *path,
 				uint8_t dlci)
 {
-	struct bsc_fd *bfd = &ts->bfd;
+	struct osmo_fd *bfd = &ts->bfd;
 	struct sockaddr_un local;
 	unsigned int namelen;
 	int rc;
@@ -1415,7 +1415,7 @@ static int register_tool_server(struct tool_server *ts,
 
 	sercomm_register_rx_cb(dlci, hdlc_tool_cb);
 
-	if (bsc_register_fd(bfd) != 0) {
+	if (osmo_fd_register(bfd) != 0) {
 		fprintf(stderr, "Failed to register the bfd.\n");
 		return -1;
 	}
@@ -1503,7 +1503,7 @@ int main(int argc, char **argv)
 		exit(1);
 	}
 
-	if (bsc_register_fd(&dnload.serial_fd) != 0) {
+	if (osmo_fd_register(&dnload.serial_fd) != 0) {
 		fprintf(stderr, "Failed to register the serial.\n");
 		exit(1);
 	}
@@ -1552,7 +1552,7 @@ int main(int argc, char **argv)
 	dnload.load_address[3] = tmp_load_address & 0xff;
 
 	while (1)
-		bsc_select_main(0);
+		osmo_select_main(0);
 
 	close(dnload.serial_fd.fd);
 
diff --git a/src/host/osmocon/osmoload.c b/src/host/osmocon/osmoload.c
index 6a31dc1..1471a2e 100644
--- a/src/host/osmocon/osmoload.c
+++ b/src/host/osmocon/osmoload.c
@@ -48,7 +48,7 @@
 
 #define DEFAULT_SOCKET "/tmp/osmocom_loader"
 
-static struct bsc_fd connection;
+static struct osmo_fd connection;
 
 enum {
 	STATE_INIT,
@@ -451,7 +451,7 @@ loader_handle_reply(struct msgb *msg) {
 }
 
 static int
-loader_read_cb(struct bsc_fd *fd, unsigned int flags) {
+loader_read_cb(struct osmo_fd *fd, unsigned int flags) {
 	struct msgb *msg;
 	u_int16_t len;
 	int rc;
@@ -494,7 +494,7 @@ static void
 loader_connect(const char *socket_path) {
 	int rc;
 	struct sockaddr_un local;
-	struct bsc_fd *conn = &connection;
+	struct osmo_fd *conn = &connection;
 
 	local.sun_family = AF_UNIX;
 	strncpy(local.sun_path, socket_path, sizeof(local.sun_path));
@@ -517,7 +517,7 @@ loader_connect(const char *socket_path) {
 	conn->cb = loader_read_cb;
 	conn->data = NULL;
 
-	if (bsc_register_fd(conn) != 0) {
+	if (osmo_fd_register(conn) != 0) {
 		fprintf(stderr, "Failed to register fd.\n");
 		exit(1);
 	}
@@ -1205,7 +1205,7 @@ main(int argc, char **argv) {
 	loader_command(argv[0], argc - optind, argv + optind);
 
 	while(!osmoload.quit) {
-		bsc_select_main(0);
+		osmo_select_main(0);
 	}
 
 	if(osmoload.binfile) {
-- 
1.7.2.3





More information about the baseband-devel mailing list