summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-10-25 21:58:21 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-10-26 08:52:31 +0200
commit96682a8284cc234207d2ba6a60b8f9939c17834f (patch)
tree98b523a2f05e0f5777a177bddc1926a7658244fc /include
parent991470de0c7b59c69dd2de8110ba1ddef042a473 (diff)
downloadouroboros-96682a8284cc234207d2ba6a60b8f9939c17834f.tar.gz
ouroboros-96682a8284cc234207d2ba6a60b8f9939c17834f.zip
lib: Revise du buff API towards a memory allocator
This changes the API to the rdrbuff to treat it as a pool memory allocator. The head and tailspace to allocate in a buffer is now set system-wide instead of being passed as a parameter. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/shm_rdrbuff.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h
index 49551497..dc8418fd 100644
--- a/include/ouroboros/shm_rdrbuff.h
+++ b/include/ouroboros/shm_rdrbuff.h
@@ -42,18 +42,16 @@ void shm_rdrbuff_destroy(struct shm_rdrbuff * rdrb);
void shm_rdrbuff_purge(void);
-/* returns the index of the buffer in the DU map */
-ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb,
- size_t headspace,
- size_t tailspace,
- const uint8_t * data,
- size_t data_len);
+/* Returns block index, a ptr and du_buff. */
+ssize_t shm_rdrbuff_alloc(struct shm_rdrbuff * rdrb,
+ size_t count,
+ uint8_t ** ptr,
+ struct shm_du_buff ** sdb);
-ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb,
- size_t headspace,
- size_t tailspace,
- const uint8_t * data,
- size_t data_len,
+ssize_t shm_rdrbuff_alloc_b(struct shm_rdrbuff * rdrb,
+ size_t count,
+ uint8_t ** ptr,
+ struct shm_du_buff ** sdb,
const struct timespec * abstime);
ssize_t shm_rdrbuff_read(uint8_t ** dst,