From 2dd5cf430edaae01594d566c9f27d780c3ffb4ef Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sun, 26 Apr 2015 21:43:42 -0300 Subject: Initial commit --- block_walker.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 block_walker.h (limited to 'block_walker.h') diff --git a/block_walker.h b/block_walker.h new file mode 100644 index 0000000..00efc09 --- /dev/null +++ b/block_walker.h @@ -0,0 +1,25 @@ +#ifndef _BLOCK_WALKER_H +#define _BLOCK_WALKER_H +#include + +typedef struct _block_walker bwalker; + +/* Creacion y destruccion */ +bwalker *bwalker_create(const char *base_mem,size_t size, uint16_t *indirect_mem); +void bwalker_destroy (bwalker *bw); + +/* Consigue un bloque libre. En caso de fallar, retorna 0 */ +uint16_t bwalker_direct_length(bwalker *bw); +uint16_t bwalker_indirect_length(bwalker *bw); + +uint16_t bwalker_allocate_block(bwalker *bw); +void bwalker_free_block(bwalker *bw); + +uint16_t bwalker_next(bwalker *bw); +uint16_t bwalker_prev(bwalker *bw); +uint16_t bwalker_last_indirect (bwalker *bw); +uint16_t bwalker_last_block (bwalker *bw); +uint16_t bwalker_block_is_last(bwalker *bw); + +void bwalker_set_first(bwalker *bw); +#endif -- cgit v1.2.3-70-g09d2