summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/core/select.h15
-rw-r--r--src/ctrl/control_if.c4
-rw-r--r--src/gb/gprs_ns.c4
-rw-r--r--src/gb/gprs_ns_frgre.c4
-rw-r--r--src/gsmtap_util.c4
-rw-r--r--src/select.c16
-rw-r--r--src/socket.c2
-rw-r--r--src/vty/telnet_interface.c16
-rw-r--r--src/write_queue.c14
9 files changed, 42 insertions, 37 deletions
diff --git a/include/osmocom/core/select.h b/include/osmocom/core/select.h
index 1ba6b832..e4787b09 100644
--- a/include/osmocom/core/select.h
+++ b/include/osmocom/core/select.h
@@ -13,11 +13,16 @@
* \file select.h */
/*! Indicate interest in reading from the file descriptor */
-#define BSC_FD_READ 0x0001
+#define OSMO_FD_READ 0x0001
/*! Indicate interest in writing to the file descriptor */
-#define BSC_FD_WRITE 0x0002
+#define OSMO_FD_WRITE 0x0002
/*! Indicate interest in exceptions from the file descriptor */
-#define BSC_FD_EXCEPT 0x0004
+#define OSMO_FD_EXCEPT 0x0004
+
+/* legacy naming dating back to early OpenBSC / bsc_hack of 2008 */
+#define BSC_FD_READ OSMO_FD_READ
+#define BSC_FD_WRITE OSMO_FD_WRITE
+#define BSC_FD_EXCEPT OSMO_FD_EXCEPT
/*! Structure representing a file dsecriptor */
struct osmo_fd {
@@ -25,8 +30,8 @@ struct osmo_fd {
struct llist_head list;
/*! actual operating-system level file decriptor */
int fd;
- /*! bit-mask or of \ref BSC_FD_READ, \ref BSC_FD_WRITE and/or
- * \ref BSC_FD_EXCEPT */
+ /*! bit-mask or of \ref OSMO_FD_READ, \ref OSMO_FD_WRITE and/or
+ * \ref OSMO_FD_EXCEPT */
unsigned int when;
/*! call-back function to be called once file descriptor becomes
* available */
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index 0209f3be..ce2e3676 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -524,7 +524,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
char *name;
- if (!(what & BSC_FD_READ))
+ if (!(what & OSMO_FD_READ))
return 0;
fd = accept(listen_bfd->fd, NULL, NULL);
@@ -554,7 +554,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
LOGP(DLCTRL, LOGL_INFO, "accept()ed new CTRL connection from %s\n", name);
ccon->write_queue.bfd.fd = fd;
- ccon->write_queue.bfd.when = BSC_FD_READ;
+ ccon->write_queue.bfd.when = OSMO_FD_READ;
ret = osmo_fd_register(&ccon->write_queue.bfd);
if (ret < 0) {
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 8c3b0fa2..c7ff78ed 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -2006,9 +2006,9 @@ static int nsip_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
- if (what & BSC_FD_READ)
+ if (what & OSMO_FD_READ)
rc = handle_nsip_read(bfd);
- if (what & BSC_FD_WRITE)
+ if (what & OSMO_FD_WRITE)
rc = handle_nsip_write(bfd);
return rc;
diff --git a/src/gb/gprs_ns_frgre.c b/src/gb/gprs_ns_frgre.c
index 483fdb69..dbbd8d29 100644
--- a/src/gb/gprs_ns_frgre.c
+++ b/src/gb/gprs_ns_frgre.c
@@ -315,9 +315,9 @@ static int nsfrgre_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
- if (what & BSC_FD_READ)
+ if (what & OSMO_FD_READ)
rc = handle_nsfrgre_read(bfd);
- if (what & BSC_FD_WRITE)
+ if (what & OSMO_FD_WRITE)
rc = handle_nsfrgre_write(bfd);
return rc;
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 385b4672..996830f6 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -355,7 +355,7 @@ static int gsmtap_sink_fd_cb(struct osmo_fd *fd, unsigned int flags)
int rc;
uint8_t buf[4096];
- if (!(flags & BSC_FD_READ))
+ if (!(flags & OSMO_FD_READ))
return 0;
rc = read(fd->fd, buf, sizeof(buf));
@@ -395,7 +395,7 @@ int gsmtap_source_add_sink(struct gsmtap_inst *gti)
sink_ofd = &gti->sink_ofd;
sink_ofd->fd = fd;
- sink_ofd->when = BSC_FD_READ;
+ sink_ofd->when = OSMO_FD_READ;
sink_ofd->cb = gsmtap_sink_fd_cb;
rc = osmo_fd_register(sink_ofd);
diff --git a/src/select.c b/src/select.c
index 4e7be354..7ce135f5 100644
--- a/src/select.c
+++ b/src/select.c
@@ -55,7 +55,7 @@ static int unregistered_count;
/*! Set up an osmo-fd. Will not register it.
* \param[inout] ofd Osmo FD to be set-up
* \param[in] fd OS-level file descriptor number
- * \param[in] when bit-mask of BSC_FD_{READ,WRITE,EXECEPT}
+ * \param[in] when bit-mask of OSMO_FD_{READ,WRITE,EXECEPT}
* \param[in] cb Call-back function to be called
* \param[in] data Private context pointer
* \param[in] priv_nr Private number
@@ -171,13 +171,13 @@ inline int osmo_fd_fill_fds(void *_rset, void *_wset, void *_eset)
int highfd = 0;
llist_for_each_entry(ufd, &osmo_fds, list) {
- if (ufd->when & BSC_FD_READ)
+ if (ufd->when & OSMO_FD_READ)
FD_SET(ufd->fd, readset);
- if (ufd->when & BSC_FD_WRITE)
+ if (ufd->when & OSMO_FD_WRITE)
FD_SET(ufd->fd, writeset);
- if (ufd->when & BSC_FD_EXCEPT)
+ if (ufd->when & OSMO_FD_EXCEPT)
FD_SET(ufd->fd, exceptset);
if (ufd->fd > highfd)
@@ -199,17 +199,17 @@ restart:
int flags = 0;
if (FD_ISSET(ufd->fd, readset)) {
- flags |= BSC_FD_READ;
+ flags |= OSMO_FD_READ;
FD_CLR(ufd->fd, readset);
}
if (FD_ISSET(ufd->fd, writeset)) {
- flags |= BSC_FD_WRITE;
+ flags |= OSMO_FD_WRITE;
FD_CLR(ufd->fd, writeset);
}
if (FD_ISSET(ufd->fd, exceptset)) {
- flags |= BSC_FD_EXCEPT;
+ flags |= OSMO_FD_EXCEPT;
FD_CLR(ufd->fd, exceptset);
}
@@ -327,7 +327,7 @@ int osmo_timerfd_setup(struct osmo_fd *ofd, int (*cb)(struct osmo_fd *, unsigned
{
ofd->cb = cb;
ofd->data = data;
- ofd->when = BSC_FD_READ;
+ ofd->when = OSMO_FD_READ;
if (ofd->fd < 0) {
int rc;
diff --git a/src/socket.c b/src/socket.c
index 6a3f2540..3a46ad02 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -414,7 +414,7 @@ static inline int osmo_fd_init_ofd(struct osmo_fd *ofd, int sfd)
return sfd;
ofd->fd = sfd;
- ofd->when = BSC_FD_READ;
+ ofd->when = OSMO_FD_READ;
rc = osmo_fd_register(ofd);
if (rc < 0) {
diff --git a/src/vty/telnet_interface.c b/src/vty/telnet_interface.c
index e090e17e..dc23b12a 100644
--- a/src/vty/telnet_interface.c
+++ b/src/vty/telnet_interface.c
@@ -59,7 +59,7 @@ static void *tall_telnet_ctx;
static int telnet_new_connection(struct osmo_fd *fd, unsigned int what);
static struct osmo_fd server_socket = {
- .when = BSC_FD_READ,
+ .when = OSMO_FD_READ,
.cb = telnet_new_connection,
.priv_nr = 0,
};
@@ -142,8 +142,8 @@ static int client_data(struct osmo_fd *fd, unsigned int what)
struct telnet_connection *conn = fd->data;
int rc = 0;
- if (what & BSC_FD_READ) {
- conn->fd.when &= ~BSC_FD_READ;
+ if (what & OSMO_FD_READ) {
+ conn->fd.when &= ~OSMO_FD_READ;
rc = vty_read(conn->vty);
}
@@ -151,10 +151,10 @@ static int client_data(struct osmo_fd *fd, unsigned int what)
if (rc == -EBADF)
return rc;
- if (what & BSC_FD_WRITE) {
+ if (what & OSMO_FD_WRITE) {
rc = buffer_flush_all(conn->vty->obuf, fd->fd);
if (rc == BUFFER_EMPTY)
- conn->fd.when &= ~BSC_FD_WRITE;
+ conn->fd.when &= ~OSMO_FD_WRITE;
}
return rc;
@@ -177,7 +177,7 @@ static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
connection->priv = fd->data;
connection->fd.data = connection;
connection->fd.fd = new_connection;
- connection->fd.when = BSC_FD_READ;
+ connection->fd.when = OSMO_FD_READ;
connection->fd.cb = client_data;
rc = osmo_fd_register(&connection->fd);
if (rc < 0) {
@@ -219,10 +219,10 @@ void vty_event(enum event event, int sock, struct vty *vty)
switch (event) {
case VTY_READ:
- bfd->when |= BSC_FD_READ;
+ bfd->when |= OSMO_FD_READ;
break;
case VTY_WRITE:
- bfd->when |= BSC_FD_WRITE;
+ bfd->when |= OSMO_FD_WRITE;
break;
case VTY_CLOSED:
/* vty layer is about to free() vty */
diff --git a/src/write_queue.c b/src/write_queue.c
index fb6839a2..3399b0f1 100644
--- a/src/write_queue.c
+++ b/src/write_queue.c
@@ -47,22 +47,22 @@ int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what)
queue = container_of(fd, struct osmo_wqueue, bfd);
- if (what & BSC_FD_READ) {
+ if (what & OSMO_FD_READ) {
rc = queue->read_cb(fd);
if (rc == -EBADF)
goto err_badfd;
}
- if (what & BSC_FD_EXCEPT) {
+ if (what & OSMO_FD_EXCEPT) {
rc = queue->except_cb(fd);
if (rc == -EBADF)
goto err_badfd;
}
- if (what & BSC_FD_WRITE) {
+ if (what & OSMO_FD_WRITE) {
struct msgb *msg;
- fd->when &= ~BSC_FD_WRITE;
+ fd->when &= ~OSMO_FD_WRITE;
/* the queue might have been emptied */
if (!llist_empty(&queue->msg_queue)) {
@@ -76,7 +76,7 @@ int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what)
goto err_badfd;
if (!llist_empty(&queue->msg_queue))
- fd->when |= BSC_FD_WRITE;
+ fd->when |= OSMO_FD_WRITE;
}
}
@@ -115,7 +115,7 @@ int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data)
++queue->current_length;
msgb_enqueue(&queue->msg_queue, data);
- queue->bfd.when |= BSC_FD_WRITE;
+ queue->bfd.when |= OSMO_FD_WRITE;
return 0;
}
@@ -133,7 +133,7 @@ void osmo_wqueue_clear(struct osmo_wqueue *queue)
}
queue->current_length = 0;
- queue->bfd.when &= ~BSC_FD_WRITE;
+ queue->bfd.when &= ~OSMO_FD_WRITE;
}
/*! @} */