pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/34242 )
Change subject: write_queue: Introduce API osmo_wqueue_set_max_length() ......................................................................
write_queue: Introduce API osmo_wqueue_set_max_length()
Change-Id: Ia1b138ed622f5efaa761bd9fa062b25b598f356f --- M TODO-RELEASE M include/osmocom/core/write_queue.h M src/core/libosmocore.map M src/core/write_queue.c 4 files changed, 22 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/42/34242/1
diff --git a/TODO-RELEASE b/TODO-RELEASE index f78104e..70664ff 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -17,4 +17,5 @@ libosmogsm MODIFY osmo_auth_impl callback function signature change. No known external users libosmogsm ADD osmo_auth_c2 libosmogsm ADD OSMO_AUTH_ALG_TUAK -libosmogsm ADD new API msgb_tv32_push() \ No newline at end of file +libosmogsm ADD new API msgb_tv32_push() +libosmocore ADD osmo_wqueue_set_max_length() \ No newline at end of file diff --git a/include/osmocom/core/write_queue.h b/include/osmocom/core/write_queue.h index 6cb0a6b..d66a3c9 100644 --- a/include/osmocom/core/write_queue.h +++ b/include/osmocom/core/write_queue.h @@ -48,6 +48,7 @@
void osmo_wqueue_init(struct osmo_wqueue *queue, int max_length); void osmo_wqueue_clear(struct osmo_wqueue *queue); +void osmo_wqueue_set_max_length(struct osmo_wqueue *queue, unsigned int max_length); int osmo_wqueue_enqueue(struct osmo_wqueue *queue, struct msgb *data); int osmo_wqueue_enqueue_quiet(struct osmo_wqueue *queue, struct msgb *data); int osmo_wqueue_bfd_cb(struct osmo_fd *fd, unsigned int what); diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index 99be86c..9630ded 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -565,6 +565,7 @@ osmo_wqueue_enqueue; osmo_wqueue_enqueue_quiet; osmo_wqueue_init; +osmo_wqueue_set_max_length; rate_ctr_add; rate_ctr_difference; rate_ctr_for_each_counter; diff --git a/src/core/write_queue.c b/src/core/write_queue.c index 884cebd..f8df124 100644 --- a/src/core/write_queue.c +++ b/src/core/write_queue.c @@ -99,6 +99,15 @@ INIT_LLIST_HEAD(&queue->msg_queue); }
+/*! Set maximum length of write queue + * \param[in] queue Write queue to operate on + * \param[in] max_length Maximum length of write queue + */ +void osmo_wqueue_set_max_length(struct osmo_wqueue *queue, unsigned int max_length) +{ + queue->max_length = max_length; +} + /*! Enqueue a new \ref msgb into a write queue (without logging full queue events) * \param[in] queue Write queue to be used * \param[in] data to-be-enqueued message buffer