X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=misc%2Fe2image.c;h=347759b219771335acce728e9c91e37537e543b8;hb=fd01e467798a47b05863adf217310501767649a0;hp=30f25432a3db4a2b87626a5436bf72c6b744665e;hpb=6dac306792b98ae9111e8da2b2f4341592812c5a;p=tools%2Fe2fsprogs.git diff --git a/misc/e2image.c b/misc/e2image.c index 30f2543..347759b 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -104,11 +104,11 @@ static int get_bits_from_size(size_t size) static void usage(void) { - fprintf(stderr, _("Usage: %s [ -r|Q ] [ -f ] [ -b superblock ] [ -B blocksize]" - "[ -fr ] device image-file\n"), + fprintf(stderr, _("Usage: %s [ -r|-Q ] [ -f ] [ -b superblock ] [ -B blocksize ] " + "device image-file\n"), program_name); fprintf(stderr, _(" %s -I device image-file\n"), program_name); - fprintf(stderr, _(" %s -ra [ -cfnp ] [ -o src_offset ] " + fprintf(stderr, _(" %s -ra [ -cfnp ] [ -o src_offset ] " "[ -O dest_offset ] src_fs [ dest_fs ]\n"), program_name); exit (1); @@ -192,7 +192,8 @@ static void generic_write(int fd, void *buf, int blocksize, blk64_t block) if (block) com_err(program_name, err, - _("error writing block %llu"), block); + _("error writing block %llu"), + (unsigned long long) block); else com_err(program_name, err, "%s", _("error in generic_write()")); @@ -312,7 +313,7 @@ struct process_block_struct { * structure, so there's no point in letting the ext2fs library read * the inode again. */ -static ino_t stashed_ino = 0; +static ext2_ino_t stashed_ino = 0; static struct ext2_inode *stashed_inode; static errcode_t meta_get_blocks(ext2_filsys fs EXT2FS_ATTR((unused)), @@ -565,8 +566,10 @@ static void sigint_handler(int unused EXT2FS_ATTR((unused))) static int print_progress(blk64_t num, blk64_t total) { - return fprintf(stderr, _("%llu / %llu blocks (%d%%)"), num, total, - calc_percent(num, total)); + return fprintf(stderr, _("%llu / %llu blocks (%d%%)"), + (unsigned long long) num, + (unsigned long long) total, + calc_percent(num, total)); } static void output_meta_data_blocks(ext2_filsys fs, int fd, int flags) @@ -671,7 +674,8 @@ more_blocks: retval = io_channel_read_blk64(fs->io, blk, 1, buf); if (retval) { com_err(program_name, retval, - _("error reading block %llu"), blk); + _("error reading block %llu"), + (unsigned long long) blk); } total_written++; if (scramble_block_map && @@ -726,7 +730,8 @@ more_blocks: fputc('\r', stderr); strftime(buff, 30, "%T", gmtime(&duration)); fprintf(stderr, _("Copied %llu / %llu blocks (%d%%) in %s "), - total_written, meta_blocks_count, + (unsigned long long) total_written, + (unsigned long long) meta_blocks_count, calc_percent(total_written, meta_blocks_count), buff); if (duration) fprintf(stderr, _("at %.2f MB/s"), @@ -892,8 +897,9 @@ static errcode_t initialize_qcow2_image(int fd, ext2_filsys fs, int cluster_bits = get_bits_from_size(fs->blocksize); struct ext2_super_block *sb = fs->super; - if (fs->blocksize < 1024) - return EINVAL; /* Can never happen, but just in case... */ + /* Sbould never happen, but just in case... */ + if (cluster_bits < 0) + return EXT2_FILSYS_CORRUPTED; /* Allocate header */ ret = ext2fs_get_memzero(sizeof(struct ext2_qcow2_hdr), &header); @@ -1201,7 +1207,8 @@ static void output_qcow2_meta_data_blocks(ext2_filsys fs, int fd) retval = io_channel_read_blk64(fs->io, blk, 1, buf); if (retval) { com_err(program_name, retval, - _("error reading block %llu"), blk); + _("error reading block %llu"), + (unsigned long long) blk); continue; } if (scramble_block_map && @@ -1482,7 +1489,8 @@ int main (int argc, char ** argv) ext2_filsys fs; char *image_fn, offset_opt[64]; struct ext2_qcow2_hdr *header = NULL; - int open_flag = EXT2_FLAG_64BITS | EXT2_FLAG_IGNORE_CSUM_ERRORS; + int open_flag = EXT2_FLAG_64BITS | EXT2_FLAG_THREADS | + EXT2_FLAG_IGNORE_CSUM_ERRORS; int img_type = 0; int flags = 0; int mount_flags = 0; @@ -1620,7 +1628,7 @@ int main (int argc, char ** argv) goto skip_device; } } - sprintf(offset_opt, "offset=%llu", source_offset); + sprintf(offset_opt, "offset=%llu", (unsigned long long) source_offset); retval = ext2fs_open2(device_name, offset_opt, open_flag, superblock, blocksize, unix_io_manager, &fs); if (retval) {