ext4_utils: move sparse file pointer out of fs_info
Move the sparse file pointer out of the fs_info struct in
preparation for exporting fs_info without sparse file support.
Change-Id: I5a72147fe4fb24296e615cb82dbba91c6dc6f7f0
diff --git a/ext4_utils/ext4_utils.c b/ext4_utils/ext4_utils.c
index 3547545..8c9d931 100644
--- a/ext4_utils/ext4_utils.c
+++ b/ext4_utils/ext4_utils.c
@@ -44,6 +44,7 @@
int force = 0;
struct fs_info info;
struct fs_aux_info aux_info;
+struct sparse_file *ext4_sparse_file;
jmp_buf setjmp_env;
@@ -81,7 +82,7 @@
/* Write the filesystem image to a file */
void write_ext4_image(int fd, int gz, int sparse, int crc)
{
- sparse_file_write(info.sparse_file, fd, gz, sparse, crc);
+ sparse_file_write(ext4_sparse_file, fd, gz, sparse, crc);
}
/* Compute the rest of the parameters of the filesystem from the basic info */
@@ -225,10 +226,10 @@
memcpy(aux_info.backup_sb[i], sb, info.block_size);
/* Update the block group nr of this backup superblock */
aux_info.backup_sb[i]->s_block_group_nr = i;
- sparse_file_add_data(info.sparse_file, aux_info.backup_sb[i],
+ sparse_file_add_data(ext4_sparse_file, aux_info.backup_sb[i],
info.block_size, group_start_block);
}
- sparse_file_add_data(info.sparse_file, aux_info.bg_desc,
+ sparse_file_add_data(ext4_sparse_file, aux_info.bg_desc,
aux_info.bg_desc_blocks * info.block_size,
group_start_block + 1);
header_size = 1 + aux_info.bg_desc_blocks + info.bg_desc_reserve_blocks;
@@ -254,9 +255,9 @@
if (info.block_size > 1024) {
u8 *buf = calloc(info.block_size, 1);
memcpy(buf + 1024, (u8*)aux_info.sb, 1024);
- sparse_file_add_data(info.sparse_file, buf, info.block_size, 0);
+ sparse_file_add_data(ext4_sparse_file, buf, info.block_size, 0);
} else {
- sparse_file_add_data(info.sparse_file, aux_info.sb, 1024, 1);
+ sparse_file_add_data(ext4_sparse_file, aux_info.sb, 1024, 1);
}
}