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/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11415 )
Change subject: scheduler_trx.c: Switch to osmo_timerfd() of libosmocore >= 0.12.0
......................................................................
scheduler_trx.c: Switch to osmo_timerfd() of libosmocore >= 0.12.0
Change-Id: I721d493659fde57eca1543b2e63171df1be1279d
Fixes: Coverity CID#178646
---
M configure.ac
M src/osmo-bts-trx/scheduler_trx.c
2 files changed, 10 insertions(+), 72 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
diff --git a/configure.ac b/configure.ac
index 38e6713..f2d4f84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,12 +62,12 @@
fi
dnl checks for libraries
-PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 0.11.0)
-PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding >= 0.11.0)
+PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 0.12.0)
+PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding >= 0.12.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.5.0)
PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 0.5.0)
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 4bac235..fa3aed2 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -1434,68 +1434,6 @@
ts->tv_nsec = ts->tv_nsec % 1000000000;
}
-/*! disable the osmocom-wrapped timerfd */
-/* FIXME: Use libosmocore after release with Ibeffba7c997252c003723bcd5d14122c4ded2fe7 was made */
-static int timer_ofd_disable(struct osmo_fd *ofd)
-{
- const struct itimerspec its_null = {
- .it_value = { 0, 0 },
- .it_interval = { 0, 0 },
- };
- return timerfd_settime(ofd->fd, 0, &its_null, NULL);
-}
-
-/*! schedule the osmcoom-wrapped timerfd to occur first at \a first, then periodically at \a interval
- * \param[in] ofd Osmocom wrapped timerfd
- * \param[in] first Relative time at which the timer should first execute (NULL = \a interval)
- * \param[in] interval Time interval at which subsequent timer shall fire
- * \returns 0 on success; negative on error */
-/* FIXME: Use libosmocore after release with Ibeffba7c997252c003723bcd5d14122c4ded2fe7 was made */
-static int timer_ofd_schedule(struct osmo_fd *ofd, const struct timespec *first,
- const struct timespec *interval)
-{
- struct itimerspec its;
-
- if (ofd->fd < 0)
- return -EINVAL;
-
- /* first expiration */
- if (first)
- its.it_value = *first;
- else
- its.it_value = *interval;
- /* repeating interval */
- its.it_interval = *interval;
-
- return timerfd_settime(ofd->fd, 0, &its, NULL);
-}
-
-/*! setup osmocom-wrapped timerfd
- * \param[inout] ofd Osmocom-wrapped timerfd on which to operate
- * \param[in] cb Call-back function called when timerfd becomes readable
- * \param[in] data Opaque data to be passed on to call-back
- * \returns 0 on success; negative on error
- *
- * We simply initialize the data structures here, but do not yet
- * schedule the timer.
- */
-/* FIXME: Use libosmocore after release with Ibeffba7c997252c003723bcd5d14122c4ded2fe7 was made */
-static int timer_ofd_setup(struct osmo_fd *ofd, int (*cb)(struct osmo_fd *, unsigned int), void *data)
-{
- ofd->cb = cb;
- ofd->data = data;
- ofd->when = BSC_FD_READ;
-
- if (ofd->fd < 0) {
- ofd->fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
- if (ofd->fd < 0)
- return ofd->fd;
-
- osmo_fd_register(ofd);
- }
- return 0;
-}
-
/*! Increment a GSM frame number modulo GSM_HYPERFRAME */
#define INCREMENT_FN(fn) (fn) = (((fn) + 1) % GSM_HYPERFRAME)
@@ -1557,7 +1495,7 @@
return 0;
no_clock:
- timer_ofd_disable(&tcs->fn_timer_ofd);
+ osmo_timerfd_disable(&tcs->fn_timer_ofd);
transceiver_available = 0;
bts_shutdown(bts, "No clock from osmo-trx");
@@ -1575,8 +1513,8 @@
trx_sched_fn(bts, tcs->last_fn_timer.fn);
/* schedule first FN clock timer */
- timer_ofd_setup(&tcs->fn_timer_ofd, trx_fn_timer_cb, bts);
- timer_ofd_schedule(&tcs->fn_timer_ofd, NULL, interval);
+ osmo_timerfd_setup(&tcs->fn_timer_ofd, trx_fn_timer_cb, bts);
+ osmo_timerfd_schedule(&tcs->fn_timer_ofd, NULL, interval);
tcs->last_fn_timer.tv = *tv_now;
tcs->last_clk_ind.tv = *tv_now;
@@ -1666,7 +1604,7 @@
normalize_timespec(&first);
LOGP(DL1C, LOGL_NOTICE, "We were %d FN faster than TRX, compensating\n", -elapsed_fn);
/* set time to the time our next FN has to be transmitted */
- timer_ofd_schedule(&tcs->fn_timer_ofd, &first, &interval);
+ osmo_timerfd_schedule(&tcs->fn_timer_ofd, &first, &interval);
return 0;
}
--
To view, visit https://gerrit.osmocom.org/11415
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I721d493659fde57eca1543b2e63171df1be1279d
Gerrit-Change-Number: 11415
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181021/abdda46d/attachment.htm>