tlsf control's structure should remain opaque

This commit is contained in:
Philippe
2021-11-05 00:37:45 -07:00
committed by BOT
parent e45d350b97
commit a7b9e7a8bd
2 changed files with 24 additions and 23 deletions

View File

@@ -57,6 +57,30 @@
** NOTE: TLSF spec relies on ffs/fls returning value 0..31.
** ffs/fls return 1-32 by default, returning 0 for error.
*/
/* The TLSF control structure. */
typedef struct control_t
{
/* Empty lists point at this block to indicate they are free. */
block_header_t block_null;
/* Local parameter for the pool */
unsigned int fl_index_count;
unsigned int fl_index_shift;
unsigned int fl_index_max;
unsigned int sl_index_count;
unsigned int sl_index_count_log2;
unsigned int small_block_size;
size_t size;
/* Bitmaps for free lists. */
unsigned int fl_bitmap;
unsigned int *sl_bitmap;
/* Head of free lists. */
block_header_t** blocks;
} control_t;
static inline __attribute__((__always_inline__)) int tlsf_ffs(unsigned int word)
{
const unsigned int reverse = word & (~word + 1);

View File

@@ -72,29 +72,6 @@ typedef struct block_header_t
struct block_header_t* prev_free;
} block_header_t;
/* The TLSF control structure. */
typedef struct control_t
{
/* Empty lists point at this block to indicate they are free. */
block_header_t block_null;
/* Local parameter for the pool */
unsigned int fl_index_count;
unsigned int fl_index_shift;
unsigned int fl_index_max;
unsigned int sl_index_count;
unsigned int sl_index_count_log2;
unsigned int small_block_size;
size_t size;
/* Bitmaps for free lists. */
unsigned int fl_bitmap;
unsigned int *sl_bitmap;
/* Head of free lists. */
block_header_t** blocks;
} control_t;
#include "heap_tlsf_block_functions.h"
/* tlsf_t: a TLSF structure. Can contain 1 to N pools. */