From 3e971d7ce9e4d94d629e6ab91ee7a06d2b00b6b3 Mon Sep 17 00:00:00 2001 From: Bob Copeland Date: Sat, 10 Jul 2010 13:14:54 -0400 Subject: [PATCH] Fix incorrect swap in mkomfs --- create_fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/create_fs.c b/create_fs.c index 86fda86..a800ede 100644 --- a/create_fs.c +++ b/create_fs.c @@ -83,6 +83,7 @@ int create_fs(FILE *fp, u64 sectors, fs_config_t *config) info.super = &super; info.root = &root; info.bitmap = &bitmap; + info.swap = 0; // super block omfs_write_super(&info); @@ -121,6 +122,7 @@ int create_fs(FILE *fp, u64 sectors, fs_config_t *config) // going to be set; the first available cluster has to take // into account the size of the free space bitmap. int bitmap_size = (swap_be64(super.s_num_blocks) + 7)/8; + int dirty_size = (bitmap_size + 7)/8; int first_blk = BITMAP_BLK + (bitmap_size + swap_be32(super.s_blocksize)-1) / swap_be32(super.s_blocksize); @@ -130,7 +132,10 @@ int create_fs(FILE *fp, u64 sectors, fs_config_t *config) { bitmap.bmap[i/8] |= 1<<(i & 7); } + + bitmap.dirty = malloc(dirty_size); + memset(bitmap.dirty, 0xff, dirty_size); omfs_flush_bitmap(&info); - + return 1; } -- 2.11.4.GIT