diff options
author | Not Zed <NotZed@Ximian.com> | 2001-08-10 09:19:47 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-08-10 09:19:47 +0800 |
commit | ed70b7f1412307294fd33e35aa981a37363c15e0 (patch) | |
tree | 918bd5948dea2c4c348ae0de3b932fb0a3054f66 /libibex/block.h | |
parent | d471640fe82b68d5430514120dffa69be196f852 (diff) | |
download | gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.gz gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.bz2 gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.lz gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.xz gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.zst gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.zip |
NOOP if writing to a failed file. (word_index_pre): NOOP if failed file.
2001-08-10 Not Zed <NotZed@Ximian.com>
* wordindexmem.c (sync_cache_entry): NOOP if writing to a failed
file.
(word_index_pre): NOOP if failed file.
(ibex_create_word_index_mem): Setup blocks value.
** Added internal exception handling to libibex, in the case of
errors with on-disk data, exceptions are returned.
* block.c (ibex_block_cache_open): Detect fatal errors below us
and clean up appropriately.
(ibex_block_cache_fail): New function to handle the failure, and
keep track of it.
(ibex_block_cache_sync): Dont do anything if we've failed on this
file.
* disktail.c (tail_compress): Add blocks param so we can assert
for exceptions.
* hash.c, block.c disktail.c: g_assert->ibex_block_cache_assert
where dealing with external data.
* hash.c (hash_info): Add index param so we can assert for exceptions.
* ibex_block.c (ibex_index_buffer): Setjmp before calling into
internal routines.
(ibex_save): "
(ibex_unindex): "
(ibex_find): "
(ibex_find_name): "
(ibex_contains_name): "
(ibex_reset): Function to reset the index file if we have an
error, call when we have an error.
* block.h (ibex_block_cache_assert): Create assertion/exception
macros, and include a setjmp buffer for returning it.
2001-08-09 Not Zed <NotZed@Ximian.com>
* Makefile.am (libibex_la_SOURCES): Remove wordindex.c,
wordindexmem is what's used.
svn path=/trunk/; revision=11864
Diffstat (limited to 'libibex/block.h')
-rw-r--r-- | libibex/block.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libibex/block.h b/libibex/block.h index dbc8fd5ad8..74221836e1 100644 --- a/libibex/block.h +++ b/libibex/block.h @@ -7,6 +7,7 @@ /*#define IBEX_STATS*/ /* define to get/dump block access stats */ #include <glib.h> +#include <setjmp.h> /* version of file format */ #define IBEX_VERSION "ibx6" @@ -78,7 +79,12 @@ struct _memcache { int count; /* nodes in cache */ GHashTable *index; /* blockid->memblock mapping */ + int fd; /* file fd */ + char *name; /* file name */ + + jmp_buf failenv; /* for exception failure */ + int failed; /* indicates the file failed */ #ifdef IBEX_STATS GHashTable *stats; @@ -103,6 +109,11 @@ 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); +#define ibex_block_cache_setjmp(bc) (((bc)==NULL)?1:setjmp((bc)->failenv)) +#define ibex_block_cache_assert(bc, cond) { if (!(cond)) { ibex_block_cache_fail(bc, __FILE__, __LINE__, # cond); } } + +void ibex_block_cache_fail(struct _memcache *block_cache, char *file, int line, char *why); + 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); |