// SPDX-License-Identifier: GPL-2.0+ AND LGPL-2.0+ AND LGPL-2.1+

#ifndef _MVB_HEAP_H_
#define _MVB_HEAP_H_

#include <stdint.h>
#include <stddef.h>

#define MVB_RET_OK    0
#define MVB_RET_FAIL -1

enum MVB_HEAP_FLAG {
    MVB_HEAP_FLAG_SECURE = (1 << 0),
    MVB_HEAP_FLAG_CACHED = (1 << 1),
};

struct mvb_heap_t;
struct mvb_slot_t;

int
mvb_slot_get_size (struct mvb_slot_t* slot);
int
mvb_slot_get_fd (struct mvb_slot_t* slot);
uint32_t
mvb_slot_get_flag (struct mvb_slot_t* slot);

void*
mvb_slot_mmap (struct mvb_slot_t* slot);
void
mvb_slot_umap (struct mvb_slot_t* slot);


struct mvb_slot_t*
mvb_heap_alloc_slot (struct mvb_heap_t* p_mvb_heap, int size, uint32_t mvb_flag);
void
mvb_heap_free_slot (struct mvb_slot_t* slot);

struct mvb_heap_t*
mvb_heap_create (const char* heap_name);
void
mvb_heap_destroy (struct mvb_heap_t* p_mvb_heap);


#endif
