-/* $Id: bfile.c,v 1.36 2004-08-04 08:35:22 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
- Index Data Aps
+/* $Id: bfile.c,v 1.39 2005-01-15 19:38:17 adam Exp $
+ Copyright (C) 1995-2005
+ Index Data ApS
This file is part of the Zebra server.
02111-1307, USA.
*/
-
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
#include <zebrautl.h>
-#include <bfile.h>
-
+#include <idzebra/bfile.h>
+#include "mfile.h"
#include "cfile.h"
+struct BFile_struct
+{
+ MFile mf;
+ Zebra_lock_rdwr rdwr_lock;
+ struct CFile_struct *cf;
+};
+
struct BFiles_struct {
MFile_area commit_area;
MFile_area_struct *register_area;
{
if (spec)
{
- yaz_log (LOG_LOG, "enabling cache spec=%s", spec);
+ yaz_log (YLOG_LOG, "enabling cache spec=%s", spec);
if (!bfs->commit_area)
bfs->commit_area = mf_init ("shadow", spec, bfs->base);
if (bfs->commit_area)
8);
strcpy (bfs->cache_fname, bfs->commit_area->dirs->name);
strcat (bfs->cache_fname, "/cache");
- yaz_log (LOG_LOG, "cache_fname = %s", bfs->cache_fname);
+ yaz_log (YLOG_LOG, "cache_fname = %s", bfs->cache_fname);
}
}
else
BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag)
{
- BFile tmp = (BFile) xmalloc(sizeof(BFile_struct));
+ BFile tmp = (BFile) xmalloc(sizeof(struct BFile_struct));
if (bfs->commit_area)
{
outf = open_cache (bfs, "ab");
if (!outf)
{
- logf (LOG_FATAL|LOG_ERRNO, "open %s", bfs->cache_fname);
+ yaz_log (YLOG_FATAL|YLOG_ERRNO, "open %s", bfs->cache_fname);
exit (1);
}
fprintf (outf, "%s %d\n", name, block_size);
}
if (!tmp->mf)
{
- logf (LOG_FATAL, "mf_open failed for %s", name);
+ yaz_log (YLOG_FATAL, "mf_open failed for %s", name);
xfree (tmp);
return 0;
}
assert (bfs->commit_area);
if (!(inf = open_cache (bfs, "rb")))
{
- logf (LOG_LOG, "No commit file");
+ yaz_log (YLOG_LOG, "No commit file");
return ;
}
while (fscanf (inf, "%s %d", path, &block_size) == 2)