summaryrefslogtreecommitdiff
path: root/src/memblockq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/memblockq.c')
-rw-r--r--src/memblockq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/memblockq.c b/src/memblockq.c
index 10c59e50..9a601c3a 100644
--- a/src/memblockq.c
+++ b/src/memblockq.c
@@ -220,3 +220,12 @@ uint32_t memblockq_get_length(struct memblockq *bq) {
assert(bq);
return bq->total_length;
}
+
+uint32_t memblockq_missing_to(struct memblockq *bq, size_t qlen) {
+ assert(bq && qlen);
+
+ if (bq->total_length >= qlen)
+ return 0;
+
+ return qlen - bq->total_length;
+}