2 * Copyright (C) 1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1995-12-01 11:37:24 adam
8 * Cached/commit files implemented as meta-files.
10 * Revision 1.1 1995/11/30 08:33:13 adam
11 * Started work on commit facility.
22 void cf_commit (CFile cf)
26 struct CFile_ph_bucket *p;
28 if (cf->bucket_in_memory)
30 logf (LOG_FATAL, "Cannot commit potential dirty cache");
33 p = xmalloc (sizeof(*p));
34 hash_bytes = cf->head.hash_size * sizeof(int);
35 bucket_no = (hash_bytes+sizeof(cf->head))/HASH_BSIZE + 2;
36 for (; bucket_no < cf->head.next_bucket; bucket_no++)
38 if (!mf_read (cf->hash_mf, bucket_no, 0, 0, p))
40 logf (LOG_FATAL, "read commit hash");
43 for (i = 0; i<HASH_BUCKET && p->vno[i]; i++)
45 if (!mf_read (cf->block_mf, p->vno[i], 0, 0, cf->iobuf))
47 logf (LOG_FATAL, "read commit block");
50 mf_write (cf->rmf, p->no[i], 0, 0, cf->iobuf);