- return mf_write(bf->mf, no, offset, num, buf);
+ if (bf->cf)
+ return cf_write (bf->cf, no, offset, num, buf);
+ return mf_write (bf->mf, no, offset, num, buf);
+}
+
+void bf_commit (void)
+{
+ FILE *inf;
+ int block_size;
+ char path[256];
+ MFile mf;
+ CFile cf;
+ int first_time;
+
+ assert (commit_area);
+ if (!(inf = fopen ("cache", "r")))
+ {
+ logf (LOG_FATAL|LOG_ERRNO, "cannot open commit %s", "cache");
+ exit (1);
+ }
+ while (fscanf (inf, "%s %d", path, &block_size) == 2)
+ {
+ mf = mf_open (0, path, block_size, 1);
+ cf = cf_open (mf, commit_area, path, block_size, 0, &first_time);
+
+ cf_commit (cf);
+
+ cf_close (cf);
+ mf_close (mf);
+ }
+ fclose (inf);