summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-05-07 12:42:40 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2011-05-07 13:00:51 +0200
commitf7f89d0cfec33a3c2a2fe631e29b07eea31536f4 (patch)
treea92fb8e15ef2faa7c627286a16805d74a04ecb3e
parent0b21c1c8850d7f33f55d9399d14055a7cdda3614 (diff)
select: use namespace prefix osmo_fd* and osmo_select*
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
-rw-r--r--include/osmocom/core/select.h10
-rw-r--r--include/osmocom/core/write_queue.h10
-rw-r--r--include/osmocom/vty/telnet_interface.h2
-rw-r--r--src/gsmtap_util.c12
-rw-r--r--src/select.c22
-rw-r--r--src/vty/telnet_interface.c18
-rw-r--r--src/write_queue.c2
-rw-r--r--tests/timer/timer_test.c2
8 files changed, 39 insertions, 39 deletions
diff --git a/include/osmocom/core/select.h b/include/osmocom/core/select.h
index 5ca21c3e..476c564e 100644
--- a/include/osmocom/core/select.h
+++ b/include/osmocom/core/select.h
@@ -7,16 +7,16 @@
#define BSC_FD_WRITE 0x0002
#define BSC_FD_EXCEPT 0x0004
-struct bsc_fd {
+struct osmo_fd {
struct llist_head list;
int fd;
unsigned int when;
- int (*cb)(struct bsc_fd *fd, unsigned int what);
+ int (*cb)(struct osmo_fd *fd, unsigned int what);
void *data;
unsigned int priv_nr;
};
-int bsc_register_fd(struct bsc_fd *fd);
-void bsc_unregister_fd(struct bsc_fd *fd);
-int bsc_select_main(int polling);
+int osmo_fd_register(struct osmo_fd *fd);
+void osmo_fd_unregister(struct osmo_fd *fd);
+int osmo_select_main(int polling);
#endif /* _BSC_SELECT_H */
diff --git a/include/osmocom/core/write_queue.h b/include/osmocom/core/write_queue.h
index 3b730c77..8d360cbf 100644
--- a/include/osmocom/core/write_queue.h
+++ b/include/osmocom/core/write_queue.h
@@ -27,20 +27,20 @@
#include <osmocom/core/msgb.h>
struct write_queue {
- struct bsc_fd bfd;
+ struct osmo_fd bfd;
unsigned int max_length;
unsigned int current_length;
struct llist_head msg_queue;
- int (*read_cb)(struct bsc_fd *fd);
- int (*write_cb)(struct bsc_fd *fd, struct msgb *msg);
- int (*except_cb)(struct bsc_fd *fd);
+ int (*read_cb)(struct osmo_fd *fd);
+ int (*write_cb)(struct osmo_fd *fd, struct msgb *msg);
+ int (*except_cb)(struct osmo_fd *fd);
};
void write_queue_init(struct write_queue *queue, int max_length);
void write_queue_clear(struct write_queue *queue);
int write_queue_enqueue(struct write_queue *queue, struct msgb *data);
-int write_queue_bfd_cb(struct bsc_fd *fd, unsigned int what);
+int write_queue_bfd_cb(struct osmo_fd *fd, unsigned int what);
#endif
diff --git a/include/osmocom/vty/telnet_interface.h b/include/osmocom/vty/telnet_interface.h
index 0c034e41..1d8055e7 100644
--- a/include/osmocom/vty/telnet_interface.h
+++ b/include/osmocom/vty/telnet_interface.h
@@ -29,7 +29,7 @@
struct telnet_connection {
struct llist_head entry;
void *priv;
- struct bsc_fd fd;
+ struct osmo_fd fd;
struct vty *vty;
struct log_target *dbg;
};
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index b47f6e35..e0bc848c 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -42,8 +42,8 @@
#include <string.h>
#include <errno.h>
-static struct bsc_fd gsmtap_bfd = { .fd = -1 };
-static struct bsc_fd gsmtap_sink_bfd = { .fd = -1 };
+static struct osmo_fd gsmtap_bfd = { .fd = -1 };
+static struct osmo_fd gsmtap_sink_bfd = { .fd = -1 };
static LLIST_HEAD(gsmtap_txqueue);
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t link_id)
@@ -137,7 +137,7 @@ int gsmtap_sendmsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss,
}
/* Callback from select layer if we can write to the socket */
-static int gsmtap_fd_cb(struct bsc_fd *fd, unsigned int flags)
+static int gsmtap_fd_cb(struct osmo_fd *fd, unsigned int flags)
{
struct msgb *msg;
int rc;
@@ -195,11 +195,11 @@ int gsmtap_init(uint32_t dst_ip)
gsmtap_bfd.cb = gsmtap_fd_cb;
gsmtap_bfd.data = NULL;
- return bsc_register_fd(&gsmtap_bfd);
+ return osmo_fd_register(&gsmtap_bfd);
}
/* Callback from select layer if we can read from the sink socket */
-static int gsmtap_sink_fd_cb(struct bsc_fd *fd, unsigned int flags)
+static int gsmtap_sink_fd_cb(struct osmo_fd *fd, unsigned int flags)
{
int rc;
uint8_t buf[4096];
@@ -246,7 +246,7 @@ int gsmtap_sink_init(uint32_t bind_ip)
gsmtap_sink_bfd.cb = gsmtap_sink_fd_cb;
gsmtap_sink_bfd.data = NULL;
- return bsc_register_fd(&gsmtap_sink_bfd);
+ return osmo_fd_register(&gsmtap_sink_bfd);
}
diff --git a/src/select.c b/src/select.c
index 6c44f355..4ea95362 100644
--- a/src/select.c
+++ b/src/select.c
@@ -31,10 +31,10 @@
#ifdef HAVE_SYS_SELECT_H
static int maxfd = 0;
-static LLIST_HEAD(bsc_fds);
+static LLIST_HEAD(osmo_fds);
static int unregistered_count;
-int bsc_register_fd(struct bsc_fd *fd)
+int osmo_fd_register(struct osmo_fd *fd)
{
int flags;
@@ -52,29 +52,29 @@ int bsc_register_fd(struct bsc_fd *fd)
maxfd = fd->fd;
#ifdef BSC_FD_CHECK
- struct bsc_fd *entry;
- llist_for_each_entry(entry, &bsc_fds, list) {
+ struct osmo_fd *entry;
+ llist_for_each_entry(entry, &osmo_fds, list) {
if (entry == fd) {
- fprintf(stderr, "Adding a bsc_fd that is already in the list.\n");
+ fprintf(stderr, "Adding a osmo_fd that is already in the list.\n");
return 0;
}
}
#endif
- llist_add_tail(&fd->list, &bsc_fds);
+ llist_add_tail(&fd->list, &osmo_fds);
return 0;
}
-void bsc_unregister_fd(struct bsc_fd *fd)
+void osmo_fd_unregister(struct osmo_fd *fd)
{
unregistered_count++;
llist_del(&fd->list);
}
-int bsc_select_main(int polling)
+int osmo_select_main(int polling)
{
- struct bsc_fd *ufd, *tmp;
+ struct osmo_fd *ufd, *tmp;
fd_set readset, writeset, exceptset;
int work = 0, rc;
struct timeval no_time = {0, 0};
@@ -84,7 +84,7 @@ int bsc_select_main(int polling)
FD_ZERO(&exceptset);
/* prepare read and write fdsets */
- llist_for_each_entry(ufd, &bsc_fds, list) {
+ llist_for_each_entry(ufd, &osmo_fds, list) {
if (ufd->when & BSC_FD_READ)
FD_SET(ufd->fd, &readset);
@@ -109,7 +109,7 @@ int bsc_select_main(int polling)
/* call registered callback functions */
restart:
unregistered_count = 0;
- llist_for_each_entry_safe(ufd, tmp, &bsc_fds, list) {
+ llist_for_each_entry_safe(ufd, tmp, &osmo_fds, list) {
int flags = 0;
if (FD_ISSET(ufd->fd, &readset)) {
diff --git a/src/vty/telnet_interface.c b/src/vty/telnet_interface.c
index 0d45d614..78459944 100644
--- a/src/vty/telnet_interface.c
+++ b/src/vty/telnet_interface.c
@@ -39,9 +39,9 @@ LLIST_HEAD(active_connections);
static void *tall_telnet_ctx;
/* per network data */
-static int telnet_new_connection(struct bsc_fd *fd, unsigned int what);
+static int telnet_new_connection(struct osmo_fd *fd, unsigned int what);
-static struct bsc_fd server_socket = {
+static struct osmo_fd server_socket = {
.when = BSC_FD_READ,
.cb = telnet_new_connection,
.priv_nr = 0,
@@ -85,7 +85,7 @@ int telnet_init(void *tall_ctx, void *priv, int port)
server_socket.data = priv;
server_socket.fd = fd;
- bsc_register_fd(&server_socket);
+ osmo_fd_register(&server_socket);
return 0;
}
@@ -104,12 +104,12 @@ static void print_welcome(int fd)
ret = write(fd, host.app_info->copyright, strlen(host.app_info->copyright));
}
-int telnet_close_client(struct bsc_fd *fd)
+int telnet_close_client(struct osmo_fd *fd)
{
struct telnet_connection *conn = (struct telnet_connection*)fd->data;
close(fd->fd);
- bsc_unregister_fd(fd);
+ osmo_fd_unregister(fd);
if (conn->dbg) {
log_del_target(conn->dbg);
@@ -121,7 +121,7 @@ int telnet_close_client(struct bsc_fd *fd)
return 0;
}
-static int client_data(struct bsc_fd *fd, unsigned int what)
+static int client_data(struct osmo_fd *fd, unsigned int what)
{
struct telnet_connection *conn = fd->data;
int rc = 0;
@@ -144,7 +144,7 @@ static int client_data(struct bsc_fd *fd, unsigned int what)
return rc;
}
-static int telnet_new_connection(struct bsc_fd *fd, unsigned int what)
+static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
{
struct telnet_connection *connection;
struct sockaddr_in sockaddr;
@@ -162,7 +162,7 @@ static int telnet_new_connection(struct bsc_fd *fd, unsigned int what)
connection->fd.fd = new_connection;
connection->fd.when = BSC_FD_READ;
connection->fd.cb = client_data;
- bsc_register_fd(&connection->fd);
+ osmo_fd_register(&connection->fd);
llist_add_tail(&connection->entry, &active_connections);
print_welcome(new_connection);
@@ -182,7 +182,7 @@ static int telnet_new_connection(struct bsc_fd *fd, unsigned int what)
void vty_event(enum event event, int sock, struct vty *vty)
{
struct telnet_connection *connection = vty->priv;
- struct bsc_fd *bfd = &connection->fd;
+ struct osmo_fd *bfd = &connection->fd;
if (vty->type != VTY_TERM)
return;
diff --git a/src/write_queue.c b/src/write_queue.c
index 0642aad6..c357c3fa 100644
--- a/src/write_queue.c
+++ b/src/write_queue.c
@@ -23,7 +23,7 @@
#include <osmocom/core/write_queue.h>
-int write_queue_bfd_cb(struct bsc_fd *fd, unsigned int what)
+int write_queue_bfd_cb(struct osmo_fd *fd, unsigned int what)
{
struct write_queue *queue;
diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c
index 69bcad92..240bc480 100644
--- a/tests/timer/timer_test.c
+++ b/tests/timer/timer_test.c
@@ -69,7 +69,7 @@ int main(int argc, char** argv)
#ifdef HAVE_SYS_SELECT_H
while (1) {
- bsc_select_main(0);
+ osmo_select_main(0);
}
#else
printf("Select not supported on this platform!\n");