Many files:
  ext2fs.h (EXT2_FLAG_IMAGE_FILE): Add new flag, and add image_header
  	field in the ext2_filsys structure
  block.c (block_iterate_ind, block_iterate_dind, block_iterate_tind):
  inode.c (ext2fs_read_inode):
  rw_bitmaps.c (read_bitmaps):
  openfs.c (ext2fs_open): Add support for EXT2_FLAG_IMAGE_FILE
  imager.c (ext2fs_image_bitmap_read): Fix bug in imager to make sure
  	the full bitmap is saved.

diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 621e850..bd07023 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -64,8 +64,12 @@
 		ret |= BLOCK_ERROR;
 		return ret;
 	}
-	ctx->errcode = io_channel_read_blk(ctx->fs->io, *ind_block,
-					   1, ctx->ind_buf);
+	if (ctx->fs->flags & EXT2_FLAG_IMAGE_FILE) {
+		ctx->errcode = 0;
+		memset(ctx->ind_buf, 0, ctx->fs->blocksize);
+	} else
+		ctx->errcode = io_channel_read_blk(ctx->fs->io, *ind_block,
+						   1, ctx->ind_buf);
 	if (ctx->errcode) {
 		ret |= BLOCK_ERROR;
 		return ret;
@@ -105,7 +109,8 @@
 			offset += sizeof(blk_t);
 		}
 	}
-	if (changed & BLOCK_CHANGED) {
+	if (!(ctx->fs->flags & EXT2_FLAG_IMAGE_FILE) &&
+	    (changed & BLOCK_CHANGED)) {
 		if (ctx->fs->flags & (EXT2_FLAG_SWAP_BYTES |
 				      EXT2_FLAG_SWAP_BYTES_WRITE)) {
 			block_nr = (blk_t *) ctx->ind_buf;
@@ -149,8 +154,12 @@
 		ret |= BLOCK_ERROR;
 		return ret;
 	}
-	ctx->errcode = io_channel_read_blk(ctx->fs->io, *dind_block,
-					   1, ctx->dind_buf);
+	if (ctx->fs->flags & EXT2_FLAG_IMAGE_FILE) {
+		ctx->errcode = 0;
+		memset(ctx->dind_buf, 0, ctx->fs->blocksize);
+	} else
+		ctx->errcode = io_channel_read_blk(ctx->fs->io, *dind_block,
+						   1, ctx->dind_buf);
 	if (ctx->errcode) {
 		ret |= BLOCK_ERROR;
 		return ret;
@@ -192,7 +201,8 @@
 			offset += sizeof(blk_t);
 		}
 	}
-	if (changed & BLOCK_CHANGED) {
+	if (!(ctx->fs->flags & EXT2_FLAG_IMAGE_FILE) &&
+	    (changed & BLOCK_CHANGED)) {
 		if (ctx->fs->flags & (EXT2_FLAG_SWAP_BYTES |
 				      EXT2_FLAG_SWAP_BYTES_WRITE)) {
 			block_nr = (blk_t *) ctx->dind_buf;
@@ -236,8 +246,12 @@
 		ret |= BLOCK_ERROR;
 		return ret;
 	}
-	ctx->errcode = io_channel_read_blk(ctx->fs->io, *tind_block,
-					   1, ctx->tind_buf);
+	if (ctx->fs->flags & EXT2_FLAG_IMAGE_FILE) {
+		ctx->errcode = 0;
+		memset(ctx->tind_buf, 0, ctx->fs->blocksize);
+	} else
+		ctx->errcode = io_channel_read_blk(ctx->fs->io, *tind_block,
+						   1, ctx->tind_buf);
 	if (ctx->errcode) {
 		ret |= BLOCK_ERROR;
 		return ret;
@@ -279,7 +293,8 @@
 			offset += sizeof(blk_t);
 		}
 	}
-	if (changed & BLOCK_CHANGED) {
+	if (!(ctx->fs->flags & EXT2_FLAG_IMAGE_FILE) &&
+	    (changed & BLOCK_CHANGED)) {
 		if (ctx->fs->flags & (EXT2_FLAG_SWAP_BYTES |
 				      EXT2_FLAG_SWAP_BYTES_WRITE)) {
 			block_nr = (blk_t *) ctx->tind_buf;