From 288e7bb1fbbbf90a8c80aac2ef9f3aaa729affad Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 19 Sep 2000 12:22:00 +0000 Subject: ** Merged from IBEX_DISK branch to head. 2000-09-19 Not Zed ** Merged from IBEX_DISK branch to head. svn path=/trunk/; revision=5500 --- libibex/block.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 libibex/block.h (limited to 'libibex/block.h') diff --git a/libibex/block.h b/libibex/block.h new file mode 100644 index 0000000000..40262de6e2 --- /dev/null +++ b/libibex/block.h @@ -0,0 +1,102 @@ + +/* public interfaces for block io routines */ + +#ifndef _BLOCK_H +#define _BLOCK_H + +/*#define IBEX_STATS*/ /* define to get/dump block access stats */ + +#include + +typedef guint32 nameid_t; +typedef guint32 blockid_t; + +#define BLOCK_BITS (8) +#define BLOCK_SIZE (1<memblock mapping */ + int fd; /* file fd */ + +#ifdef IBEX_STATS + GHashTable *stats; +#endif + /* temporary here */ + struct _IBEXWord *words; /* word index */ +}; + +#ifdef IBEX_STATS +struct _stat_info { + int read; + int write; + int cache_hit; + int cache_miss; +}; +#endif /* IBEX_STATS */ + +struct _memcache *ibex_block_cache_open(const char *name, int flags, int mode); +void ibex_block_cache_close(struct _memcache *block_cache); +void ibex_block_cache_sync(struct _memcache *block_cache); +void ibex_block_cache_flush(struct _memcache *block_cache); + +blockid_t ibex_block_get(struct _memcache *block_cache); +void ibex_block_free(struct _memcache *block_cache, blockid_t blockid); +void ibex_block_dirty(struct _block *block); +struct _block *ibex_block_read(struct _memcache *block_cache, blockid_t blockid); + +#define block_number(x) ((x)>>BLOCK_BITS) +#define block_location(x) ((x)<