Bluetooth: Consolidate bt_buf_get* functions

We may soon want to have a _wait() variant of bt_buf_get, so to avoid
the number of 'get' function growing too large consolidate the
existing get() and get_reserve() functions into a single one. The new
consolidated function also takes the type as input parameter so that
we know this from the very start and thereby plan for the split into
multiple buffer pools.

Change-Id: Ia09448565349def2be9bc08d9510fedd029480b4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-04-28 11:19:26 +03:00 committed by Anas Nashif
commit d829fe9755
5 changed files with 20 additions and 26 deletions

View file

@ -65,11 +65,10 @@ struct bt_buf {
uint8_t buf[BT_BUF_MAX_DATA];
};
/* Get buffer from the available buffers pool */
struct bt_buf *bt_buf_get(void);
/* Same as bt_buf_get, but also reserve headroom for potential headers */
struct bt_buf *bt_buf_get_reserve(size_t reserve_head);
/* Get buffer from the available buffers pool with specified type and
* reserved headroom.
*/
struct bt_buf *bt_buf_get(enum bt_buf_type type, size_t reserve_head);
/* Place buffer back into the available buffers pool */
void bt_buf_put(struct bt_buf *buf);