Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review/fix validation of image without checksum #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/extfsclone.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ void read_bitmap(char* device, file_system_info fs_info, unsigned long* bitmap,
/// check all free blocks in partition
if (free != fs->super->s_free_blocks_count) {
if ((fs->super->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) && (ext4_gfree_mismatch))
log_mesg(1, 0, 0, fs_opt.debug, "%s: EXT4 bitmap metadata mismatch\n", __FILE__);
log_mesg(1, 0, 0, fs_opt.debug, "%s: EXT4 bitmap metadata mismatch (%llu vs %lu)\n", __FILE__, free, fs->super->s_free_blocks_count);
else
log_mesg(0, 1, 1, fs_opt.debug, "%s: bitmap free count err, free:%llu\n", __FILE__, free);
log_mesg(0, 1, 1, fs_opt.debug, "%s: bitmap free count err, free:%llu, expected:%lu\n", __FILE__, free, fs->super->s_free_blocks_count);
}

fs_close();
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ int main(int argc, char **argv) {
} else if (opt.chkimg && img_opt.checksum_mode == CSM_NONE
&& strcmp(opt.source, "-") != 0) {

unsigned long long total_offset = (fs_info.usedblocks - 1) * fs_info.block_size;
unsigned long long total_offset = (fs_info.used_bitmap - 1) * fs_info.block_size;
char last_block[fs_info.block_size];
off_t partial_offset = INT32_MAX;

Expand Down
4 changes: 4 additions & 0 deletions src/partclone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,7 @@ void print_file_system_info(file_system_info fs_info, cmd_opt opt) {
unsigned int block_s = fs_info.block_size;
unsigned long long total = fs_info.totalblock;
unsigned long long used = fs_info.usedblocks;
unsigned long long mapped = fs_info.used_bitmap;
int debug = opt.debug;
char size_str[11];

Expand All @@ -1617,6 +1618,9 @@ void print_file_system_info(file_system_info fs_info, cmd_opt opt) {
print_readable_size_str(used*block_s, size_str);
log_mesg(0, 0, 1, debug, _("Space in use: %s = %llu Blocks\n"), size_str, used);

print_readable_size_str(mapped*block_s, size_str);
log_mesg(1, 0, 1, debug, _("Mapped space: %s = %llu Blocks\n"), size_str, mapped);

print_readable_size_str((total-used)*block_s, size_str);
log_mesg(0, 0, 1, debug, _("Free Space: %s = %llu Blocks\n"), size_str, (total-used));

Expand Down