2 * Copyright (C) 1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1995-12-11 09:03:55 adam
8 * New function: cf_unlink.
9 * New member of commit file head: state (0) deleted, (1) hash file.
11 * Revision 1.3 1995/12/01 16:24:29 adam
12 * Commit files use separate meta file area.
14 * Revision 1.2 1995/12/01 11:37:24 adam
15 * Cached/commit files implemented as meta-files.
17 * Revision 1.1 1995/11/30 08:33:13 adam
18 * Started work on commit facility.
29 void cf_unlink (CFile cf)
31 if (cf->bucket_in_memory)
33 logf (LOG_FATAL, "Cannot unlink potential dirty cache");
40 void cf_commit (CFile cf)
44 struct CFile_ph_bucket *p;
46 if (cf->bucket_in_memory)
48 logf (LOG_FATAL, "Cannot commit potential dirty cache");
51 p = xmalloc (sizeof(*p));
52 hash_bytes = cf->head.hash_size * sizeof(int);
53 bucket_no = (hash_bytes+sizeof(cf->head))/HASH_BSIZE + 2;
54 for (; bucket_no < cf->head.next_bucket; bucket_no++)
56 if (!mf_read (cf->hash_mf, bucket_no, 0, 0, p))
58 logf (LOG_FATAL, "read commit hash");
61 for (i = 0; i<HASH_BUCKET && p->vno[i]; i++)
63 if (!mf_read (cf->block_mf, p->vno[i], 0, 0, cf->iobuf))
65 logf (LOG_FATAL, "read commit block");
68 mf_write (cf->rmf, p->no[i], 0, 0, cf->iobuf);