25 #include <sys/types.h>
86 for (i=0; i != no_to_flush && bf->
lru_back; i++)
96 int effective_offset = p->
no -
98 int remain = bf->
block_size - effective_offset;
102 bf_write(bf->
bf, effective_block, effective_offset,
105 yaz_log(YLOG_LOG,
"bf_write no=%d offset=%d size=%d",
106 effective_block, effective_offset,
114 yaz_log(YLOG_LOG,
"bf_write1 no=%d offset=%d size=%d",
115 effective_block, effective_offset,
118 bf_write(bf->
bf, effective_block, effective_offset,
121 yaz_log(YLOG_LOG,
"bf_write2 no=%d offset=%d size=%d",
122 effective_block+1, 0, p->
nbytes - remain);
207 int effective_offset =
no - effective_block * bf->
block_size;
209 i =
bf_read(bf->
bf, effective_block, effective_offset,
211 if (i > 0 && effective_offset > 0)
212 i =
bf_read(bf->
bf, effective_block+1, 0, effective_offset,
238 printf(
"bf_newp of %d:",
no);
int bf_read(BFile bf, zint no, int offset, int nbytes, void *buf)
read from block file (may call exit)
int bf_write(BFile bf, zint no, int offset, int nbytes, const void *buf)
writes block of bytes to file (may call exit)
static void release_block(Dict_BFile bf, struct Dict_file_block *p)
static struct Dict_file_block * alloc_block(Dict_BFile bf, int no)
void dict_bf_flush_blocks(Dict_BFile bf, int no_to_flush)
int dict_bf_newp(Dict_BFile dbf, int no, void **bufp, int nbytes)
int dict_bf_readp(Dict_BFile bf, int no, void **bufp)
void dict_pr_lru(Dict_BFile bf)
int dict_bf_touch(Dict_BFile dbf, int no)
static struct Dict_file_block * find_block(Dict_BFile bf, int no)
static void move_to_front(Dict_BFile bf, struct Dict_file_block *p)
struct Dict_file_block ** h_prev
struct Dict_file_block * lru_next
struct Dict_file_block * lru_prev
struct Dict_file_block * h_next
struct Dict_file_block * free_list
struct Dict_file_block * lru_front
struct Dict_file_block * lru_back
struct Dict_file_block ** hash_array