aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-10-19 12:32:20 +0200
committerlaforge <laforge@osmocom.org>2020-10-19 10:50:45 +0000
commitbe2330fde4b0507cf53c8e893fb1cec51bd049ec (patch)
tree560d8d21121011dd329ba41d6cb44fa898174de2
parent8d2d7db81893954dfec33b52556d1cf7c71d5d2b (diff)
Use osmo_fd_setup() whenever applicable
-rw-r--r--src/gtphub/gtphub.c5
-rw-r--r--src/sgsn/sgsn_libgtp.c18
2 files changed, 4 insertions, 19 deletions
diff --git a/src/gtphub/gtphub.c b/src/gtphub/gtphub.c
index 699499f3..c24652e0 100644
--- a/src/gtphub/gtphub.c
+++ b/src/gtphub/gtphub.c
@@ -853,10 +853,7 @@ static int gtphub_sock_init(struct osmo_fd *ofd,
return -1;
}
- ofd->when = OSMO_FD_READ;
- ofd->cb = cb;
- ofd->data = data;
- ofd->priv_nr = ofd_id;
+ osmo_fd_setup(ofd, -1, OSMO_FD_READ, cb, data, ofd_id);
int rc;
rc = osmo_sock_init_ofd(ofd,
diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c
index 45a4a07a..80814924 100644
--- a/src/sgsn/sgsn_libgtp.c
+++ b/src/sgsn/sgsn_libgtp.c
@@ -776,31 +776,19 @@ int sgsn_gtp_init(struct sgsn_instance *sgi)
if (gsn->mode != GTP_MODE_SGSN)
return -EINVAL;
- sgi->gtp_fd0.fd = gsn->fd0;
- sgi->gtp_fd0.priv_nr = 0;
- sgi->gtp_fd0.data = sgi;
- sgi->gtp_fd0.when = OSMO_FD_READ;
- sgi->gtp_fd0.cb = sgsn_gtp_fd_cb;
+ osmo_fd_setup(&sgi->gtp_fd0, gsn->fd0, OSMO_FD_READ, sgsn_gtp_fd_cb, sgi, 0);
rc = osmo_fd_register(&sgi->gtp_fd0);
if (rc < 0)
return rc;
- sgi->gtp_fd1c.fd = gsn->fd1c;
- sgi->gtp_fd1c.priv_nr = 1;
- sgi->gtp_fd1c.data = sgi;
- sgi->gtp_fd1c.when = OSMO_FD_READ;
- sgi->gtp_fd1c.cb = sgsn_gtp_fd_cb;
+ osmo_fd_setup(&sgi->gtp_fd1c, gsn->fd1c, OSMO_FD_READ, sgsn_gtp_fd_cb, sgi, 1);
rc = osmo_fd_register(&sgi->gtp_fd1c);
if (rc < 0) {
osmo_fd_unregister(&sgi->gtp_fd0);
return rc;
}
- sgi->gtp_fd1u.fd = gsn->fd1u;
- sgi->gtp_fd1u.priv_nr = 2;
- sgi->gtp_fd1u.data = sgi;
- sgi->gtp_fd1u.when = OSMO_FD_READ;
- sgi->gtp_fd1u.cb = sgsn_gtp_fd_cb;
+ osmo_fd_setup(&sgi->gtp_fd1u, gsn->fd1u, OSMO_FD_READ, sgsn_gtp_fd_cb, sgi, 2);
rc = osmo_fd_register(&sgi->gtp_fd1u);
if (rc < 0) {
osmo_fd_unregister(&sgi->gtp_fd0);