IDZEBRA
2.2.7
|
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <yaz/yaz-util.h>
#include <yaz/snprintf.h>
#include <idzebra/util.h>
#include "mfile.h"
#include "cfile.h"
Go to the source code of this file.
Macros | |
#define | EXTRA_CHECK 0 |
set to 1 if extra commit/shadow check is to be performed More... | |
Functions | |
static int | write_head (CFile cf) |
static int | read_head (CFile cf) |
CFile | cf_open (MFile mf, MFile_area area, const char *fname, int block_size, int wflag, int *firstp) |
static int | cf_hash (CFile cf, zint no) |
static void | release_bucket (CFile cf, struct CFile_hash_bucket *p) |
static int | flush_bucket (CFile cf, int no_to_flush) |
static struct CFile_hash_bucket * | alloc_bucket (CFile cf, zint block_no, int hno) |
static struct CFile_hash_bucket * | get_bucket (CFile cf, zint block_no, int hno) |
static struct CFile_hash_bucket * | new_bucket (CFile cf, zint *block_nop, int hno) |
static int | cf_lookup_flat (CFile cf, zint no, zint *vno) |
static int | cf_lookup_hash (CFile cf, zint no, zint *vno) |
static int | cf_write_flat (CFile cf, zint no, zint vno) |
static int | cf_moveto_flat (CFile cf) |
static int | cf_lookup (CFile cf, zint no, zint *vno) |
static zint | cf_new_flat (CFile cf, zint no) |
static zint | cf_new_hash (CFile cf, zint no) |
zint | cf_new (CFile cf, zint no) |
int | cf_read (CFile cf, zint no, int offset, int nbytes, void *buf) |
reads block from commit area More... | |
int | cf_write (CFile cf, zint no, int offset, int nbytes, const void *buf) |
writes block to commit area More... | |
int | cf_close (CFile cf) |
#define EXTRA_CHECK 0 |
|
static |
Definition at line 239 of file cfile.c.
References CFile_struct::bucket_in_memory, CFile_struct::bucket_lru_back, CFile_struct::bucket_lru_front, flush_bucket(), CFile_hash_bucket::h_next, CFile_hash_bucket::h_prev, CFile_hash_bucket::lru_next, CFile_hash_bucket::lru_prev, CFile_struct::max_bucket_in_memory, and CFile_struct::parray.
Referenced by get_bucket(), and new_bucket().
int cf_close | ( | CFile | cf | ) |
Definition at line 616 of file cfile.c.
References CFile_struct::array, CFile_struct::block_mf, CFile_struct::bucket_in_memory, CFile_struct::dirty, CFile_head::first_bucket, flush_bucket(), CFile_struct::hash_mf, CFile_struct::head, CFile_struct::iobuf, mf_close(), mf_write(), CFile_struct::mutex, CFile_head::next_bucket, CFile_struct::no_hits, CFile_struct::no_miss, CFile_struct::parray, write_head(), zebra_mutex_destroy(), and ZINT_FORMAT.
Referenced by bf_close2(), bf_commitExec(), and cf_open().
Definition at line 190 of file cfile.c.
References CFile_head::hash_size, and CFile_struct::head.
Referenced by cf_lookup_hash(), and cf_new_hash().
Definition at line 434 of file cfile.c.
References cf_lookup_flat(), cf_lookup_hash(), CFile_struct::head, and CFile_head::state.
Referenced by cf_read(), and cf_write().
Definition at line 309 of file cfile.c.
References HASH_BSIZE, CFile_struct::hash_mf, CFile_struct::head, mf_read(), and CFile_head::next_bucket.
Referenced by cf_lookup().
Definition at line 323 of file cfile.c.
References CFile_struct::array, CFile_struct::bucket_lru_back, cf_hash(), get_bucket(), CFile_hash_bucket::h_next, HASH_BUCKET, CFile_hash_bucket::lru_next, CFile_ph_bucket::next_bucket, CFile_ph_bucket::no, CFile_struct::no_hits, CFile_struct::no_miss, CFile_struct::parray, CFile_hash_bucket::ph, CFile_ph_bucket::this_bucket, and CFile_ph_bucket::vno.
Referenced by cf_lookup().
|
static |
Definition at line 391 of file cfile.c.
References CFile_struct::array, CFile_struct::bucket_in_memory, cf_write_flat(), CFILE_STATE_FLAT, CFILE_STATE_HASH, CFile_struct::dirty, CFile_head::first_bucket, flush_bucket(), HASH_BUCKET, CFile_struct::hash_mf, CFile_struct::head, mf_read(), meta_file::name, CFile_head::next_bucket, CFile_ph_bucket::no, CFile_struct::no_hits, CFile_struct::no_miss, CFile_struct::parray, CFile_hash_bucket::ph, CFile_struct::rmf, CFile_head::state, CFile_ph_bucket::vno, and ZINT_FORMAT.
Referenced by cf_new().
Definition at line 517 of file cfile.c.
References cf_moveto_flat(), cf_new_flat(), cf_new_hash(), CFile_struct::head, CFile_struct::no_hits, CFile_struct::no_miss, and CFile_head::state.
Referenced by cf_write().
Definition at line 441 of file cfile.c.
References cf_write_flat(), CFile_struct::head, and CFile_head::next_block.
Referenced by cf_new().
Definition at line 449 of file cfile.c.
References CFile_struct::array, CFile_struct::bucket_lru_back, cf_hash(), CFile_hash_bucket::dirty, get_bucket(), CFile_hash_bucket::h_next, HASH_BUCKET, CFile_struct::head, CFile_hash_bucket::lru_next, new_bucket(), CFile_head::next_block, CFile_struct::no_hits, CFile_struct::no_miss, and CFile_struct::parray.
Referenced by cf_new().
CFile cf_open | ( | MFile | mf, |
MFile_area | area, | ||
const char * | fname, | ||
int | block_size, | ||
int | wflag, | ||
int * | firstp | ||
) |
Definition at line 82 of file cfile.c.
References CFile_struct::array, CFile_struct::block_mf, CFile_head::block_size, CFile_struct::bucket_in_memory, CFile_struct::bucket_lru_back, CFile_struct::bucket_lru_front, cf_close(), CFILE_STATE_HASH, CFile_struct::dirty, CFile_head::first_bucket, CFile_head::flat_bucket, HASH_BSIZE, CFile_struct::hash_mf, CFile_head::hash_size, CFile_struct::head, CFile_struct::iobuf, CFile_struct::max_bucket_in_memory, mf_open(), mf_read(), mf_write(), CFile_struct::mutex, CFile_head::next_block, CFile_head::next_bucket, CFile_struct::no_hits, CFile_struct::no_miss, CFile_struct::parray, read_head(), CFile_struct::rmf, CFile_head::state, write_head(), and zebra_mutex_init().
Referenced by bf_commitExec(), and bf_open().
reads block from commit area
cf | commit file |
no | block number |
offset | offset in block |
nbytes | number of bytes to read |
buf | buffer for content (if read was succesful) |
0 | block could not be fully read |
1 | block could be read |
-1 | error |
Definition at line 542 of file cfile.c.
References CFile_struct::block_mf, cf_lookup(), mf_read(), CFile_struct::mutex, zebra_mutex_lock(), zebra_mutex_unlock(), and ZINT_FORMAT.
Referenced by bf_read2().
writes block to commit area
cf | commit file |
no | block number |
offset | offset in block |
nbytes | number of bytes to be written |
buf | buffer to be written |
0 | block written |
-1 | error |
Definition at line 579 of file cfile.c.
References CFile_struct::block_mf, cf_lookup(), cf_new(), CFile_struct::iobuf, mf_read(), mf_write(), CFile_struct::mutex, CFile_struct::rmf, zebra_mutex_lock(), and zebra_mutex_unlock().
Referenced by bf_write2().
Definition at line 379 of file cfile.c.
References CFile_struct::dirty, CFile_head::flat_bucket, HASH_BSIZE, CFile_struct::hash_mf, CFile_struct::head, mf_write(), and CFile_head::next_bucket.
Referenced by cf_moveto_flat(), and cf_new_flat().
|
static |
Definition at line 214 of file cfile.c.
References CFile_struct::bucket_lru_back, CFile_hash_bucket::dirty, CFile_struct::dirty, CFile_struct::hash_mf, mf_write(), CFile_hash_bucket::ph, release_bucket(), and CFile_ph_bucket::this_bucket.
Referenced by alloc_bucket(), cf_close(), and cf_moveto_flat().
|
static |
Definition at line 269 of file cfile.c.
References alloc_bucket(), CFile_hash_bucket::dirty, CFile_struct::hash_mf, mf_read(), CFile_hash_bucket::ph, release_bucket(), and CFile_ph_bucket::this_bucket.
Referenced by cf_lookup_hash(), and cf_new_hash().
|
static |
Definition at line 287 of file cfile.c.
References alloc_bucket(), CFile_hash_bucket::dirty, HASH_BUCKET, CFile_struct::head, CFile_ph_bucket::next_bucket, CFile_head::next_bucket, CFile_ph_bucket::no, CFile_hash_bucket::ph, CFile_ph_bucket::this_bucket, and CFile_ph_bucket::vno.
Referenced by cf_new_hash().
|
static |
Definition at line 58 of file cfile.c.
References CFile_struct::array, HASH_BSIZE, CFile_struct::hash_mf, CFile_head::hash_size, CFile_struct::head, and mf_read().
Referenced by cf_open().
|
static |
Definition at line 195 of file cfile.c.
References CFile_struct::bucket_in_memory, CFile_struct::bucket_lru_back, CFile_struct::bucket_lru_front, CFile_hash_bucket::h_next, CFile_hash_bucket::h_prev, CFile_hash_bucket::lru_next, and CFile_hash_bucket::lru_prev.
Referenced by flush_bucket(), and get_bucket().
|
static |
Definition at line 36 of file cfile.c.
References CFile_struct::array, HASH_BSIZE, CFile_struct::hash_mf, CFile_head::hash_size, CFile_struct::head, and mf_write().
Referenced by cf_close(), and cf_open().