projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Swap functions - minor changes to compare tst function
[idzebra-moved-to-github.git]
/
bfile
/
bfile.c
diff --git
a/bfile/bfile.c
b/bfile/bfile.c
index
b9372fe
..
999cdf4
100644
(file)
--- a/
bfile/bfile.c
+++ b/
bfile/bfile.c
@@
-1,5
+1,5
@@
-/* $Id: bfile.c,v 1.35 2002-08-02 19:26:55 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+/* $Id: bfile.c,v 1.38 2004-12-08 12:23:08 adam Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
This file is part of the Zebra server.
Index Data Aps
This file is part of the Zebra server.
@@
-20,8
+20,6
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
02111-1307, USA.
*/
-
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-33,9
+31,17
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#endif
#include <zebrautl.h>
#endif
#include <zebrautl.h>
-#include <bfile.h>
+#include <idzebra/bfile.h>
+#include "mfile.h"
#include "cfile.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;
struct BFiles_struct {
MFile_area commit_area;
MFile_area_struct *register_area;
@@
-88,7
+94,7
@@
void bf_cache (BFiles bfs, const char *spec)
{
if (spec)
{
{
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)
if (!bfs->commit_area)
bfs->commit_area = mf_init ("shadow", spec, bfs->base);
if (bfs->commit_area)
@@
-97,7
+103,7
@@
void bf_cache (BFiles bfs, const char *spec)
8);
strcpy (bfs->cache_fname, bfs->commit_area->dirs->name);
strcat (bfs->cache_fname, "/cache");
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
}
}
else
@@
-116,7
+122,7
@@
int bf_close (BFile bf)
BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag)
{
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)
{
if (bfs->commit_area)
{
@@
-132,7
+138,7
@@
BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag)
outf = open_cache (bfs, "ab");
if (!outf)
{
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);
exit (1);
}
fprintf (outf, "%s %d\n", name, block_size);
@@
-146,7
+152,7
@@
BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag)
}
if (!tmp->mf)
{
}
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;
}
xfree (tmp);
return 0;
}
@@
-154,7
+160,7
@@
BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag)
return(tmp);
}
return(tmp);
}
-int bf_read (BFile bf, int no, int offset, int nbytes, void *buf)
+int bf_read (BFile bf, zint no, int offset, int nbytes, void *buf)
{
int r;
{
int r;
@@
-170,7
+176,7
@@
int bf_read (BFile bf, int no, int offset, int nbytes, void *buf)
return r;
}
return r;
}
-int bf_write (BFile bf, int no, int offset, int nbytes, const void *buf)
+int bf_write (BFile bf, zint no, int offset, int nbytes, const void *buf)
{
int r;
zebra_lock_rdwr_wlock (&bf->rdwr_lock);
{
int r;
zebra_lock_rdwr_wlock (&bf->rdwr_lock);
@@
-215,7
+221,7
@@
void bf_commitExec (BFiles bfs)
assert (bfs->commit_area);
if (!(inf = open_cache (bfs, "rb")))
{
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)
return ;
}
while (fscanf (inf, "%s %d", path, &block_size) == 2)