New member of commit file head: state (0) deleted, (1) hash file.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: bfile.c,v $
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: bfile.c,v $
- * Revision 1.16 1995-12-08 16:21:13 adam
+ * Revision 1.17 1995-12-11 09:03:51 adam
+ * New function: cf_unlink.
+ * New member of commit file head: state (0) deleted, (1) hash file.
+ *
+ * Revision 1.16 1995/12/08 16:21:13 adam
* Work on commit/update.
*
* Revision 1.15 1995/12/01 16:24:28 adam
* Work on commit/update.
*
* Revision 1.15 1995/12/01 16:24:28 adam
char path[256];
MFile mf;
CFile cf;
char path[256];
MFile mf;
CFile cf;
+ int mustDisable = 0;
+ int firstTime;
+
+ if (!commit_area)
+ {
+ bf_cache (1);
+ mustDisable = 1;
+ }
if (!(inf = fopen ("cache", "r")))
return ;
while (fscanf (inf, "%s %d", path, &block_size) == 2)
{
mf = mf_open (0, path, block_size, 0);
if (!(inf = fopen ("cache", "r")))
return ;
while (fscanf (inf, "%s %d", path, &block_size) == 2)
{
mf = mf_open (0, path, block_size, 0);
- cf = cf_open (mf, commit_area, path, block_size, 1, NULL);
-
+ cf = cf_open (mf, commit_area, path, block_size, 1, &firstTime);
+ cf_unlink (cf);
cf_close (cf);
mf_close (mf);
}
fclose (inf);
unlink ("cache");
cf_close (cf);
mf_close (mf);
}
fclose (inf);
unlink ("cache");
+ if (mustDisable)
+ bf_cache (0);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: cfile.c,v $
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: cfile.c,v $
- * Revision 1.5 1995-12-08 16:21:14 adam
+ * Revision 1.6 1995-12-11 09:03:53 adam
+ * New function: cf_unlink.
+ * New member of commit file head: state (0) deleted, (1) hash file.
+ *
+ * Revision 1.5 1995/12/08 16:21:14 adam
* Work on commit/update.
*
* Revision 1.4 1995/12/01 16:24:28 adam
* Work on commit/update.
*
* Revision 1.4 1995/12/01 16:24:28 adam
logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
exit (1);
}
logf (LOG_FATAL|LOG_ERRNO, "Failed to open %s", path);
exit (1);
}
- if (!firstp || !mf_read (cf->hash_mf, 0, 0, sizeof(cf->head), &cf->head))
+ assert (firstp);
+ if (!mf_read (cf->hash_mf, 0, 0, sizeof(cf->head), &cf->head) ||
+ !cf->head.state)
- if (firstp)
- *firstp = 1;
+ *firstp = 1;
+ cf->head.state = 1;
cf->head.block_size = block_size;
cf->head.hash_size = 401;
hash_bytes = cf->head.hash_size * sizeof(int);
cf->head.block_size = block_size;
cf->head.hash_size = 401;
hash_bytes = cf->head.hash_size * sizeof(int);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: cfile.h,v $
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: cfile.h,v $
- * Revision 1.3 1995-12-01 16:24:29 adam
+ * Revision 1.4 1995-12-11 09:03:54 adam
+ * New function: cf_unlink.
+ * New member of commit file head: state (0) deleted, (1) hash file.
+ *
+ * Revision 1.3 1995/12/01 16:24:29 adam
* Commit files use separate meta file area.
*
* Revision 1.2 1995/12/01 11:37:23 adam
* Commit files use separate meta file area.
*
* Revision 1.2 1995/12/01 11:37:23 adam
typedef struct CFile_struct
{
struct CFile_head {
typedef struct CFile_struct
{
struct CFile_head {
int hash_size;
int next_bucket;
int next_block;
int hash_size;
int next_bucket;
int next_block;
int wflag, int *firstp);
int cf_read (CFile cf, int no, int offset, int num, void *buf);
int cf_write (CFile cf, int no, int offset, int num, const void *buf);
int wflag, int *firstp);
int cf_read (CFile cf, int no, int offset, int num, void *buf);
int cf_write (CFile cf, int no, int offset, int num, const void *buf);
+void cf_unlink (CFile cf);
void cf_commit (CFile cf);
#endif
void cf_commit (CFile cf);
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: commit.c,v $
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: commit.c,v $
- * Revision 1.3 1995-12-01 16:24:29 adam
+ * Revision 1.4 1995-12-11 09:03:55 adam
+ * New function: cf_unlink.
+ * New member of commit file head: state (0) deleted, (1) hash file.
+ *
+ * Revision 1.3 1995/12/01 16:24:29 adam
* Commit files use separate meta file area.
*
* Revision 1.2 1995/12/01 11:37:24 adam
* Commit files use separate meta file area.
*
* Revision 1.2 1995/12/01 11:37:24 adam
#include <mfile.h>
#include "cfile.h"
#include <mfile.h>
#include "cfile.h"
+void cf_unlink (CFile cf)
+{
+ if (cf->bucket_in_memory)
+ {
+ logf (LOG_FATAL, "Cannot unlink potential dirty cache");
+ exit (1);
+ }
+ cf->head.state = 0;
+ cf->dirty = 1;
+}
+
void cf_commit (CFile cf)
{
int i, bucket_no;
void cf_commit (CFile cf)
{
int i, bucket_no;