#include "support/nls-enable.h"
#include "support/plausible.h"
+#include "support/quotaio.h"
#include "../version.h"
#define QCOW_OFLAG_COPIED (1ULL << 63)
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()"));
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)
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 &&
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"),
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);
header->refcount_table_clusters =
ext2fs_cpu_to_be32(image->refcount.refcount_table_clusters);
offset += image->cluster_size;
- offset += image->refcount.refcount_table_clusters <<
+ offset += (blk64_t) image->refcount.refcount_table_clusters <<
image->cluster_bits;
/* Make space for L2 tables */
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 &&
offset += img->cluster_size;
}
}
- update_refcount(fd, img, offset, offset);
+ (void) update_refcount(fd, img, offset, offset);
flush_l2_cache(img);
sync_refcount(fd, img);
}
if (superblock) {
- int j;
+ unsigned int j;
ext2fs_mark_block_bitmap2(meta_block_map, superblock);
meta_blocks_count++;
pb.ino = ino;
pb.is_dir = LINUX_S_ISDIR(inode.i_mode);
if (LINUX_S_ISDIR(inode.i_mode) ||
- (LINUX_S_ISLNK(inode.i_mode) &&
- ext2fs_inode_has_valid_blocks2(fs, &inode)) ||
- ino == fs->super->s_journal_inum) {
+ LINUX_S_ISLNK(inode.i_mode) ||
+ ino == fs->super->s_journal_inum ||
+ ino == quota_type2inum(USRQUOTA, fs->super) ||
+ ino == quota_type2inum(GRPQUOTA, fs->super) ||
+ ino == quota_type2inum(PRJQUOTA, fs->super) ||
+ ino == fs->super->s_orphan_file_inum) {
retval = ext2fs_block_iterate3(fs, ino,
BLOCK_FLAG_READ_ONLY, block_buf,
process_dir_block, &pb);
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;
E2FSPROGS_DATE);
if (argc && *argv)
program_name = *argv;
+ else
+ usage();
add_error_table(&et_ext2_error_table);
while ((c = getopt(argc, argv, "b:B:nrsIQafo:O:pc")) != EOF)
switch (c) {
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) {