Whamcloud - gitweb
Fix clang warnings on architectures with a 64-bit long
authorTheodore Ts'o <tytso@mit.edu>
Thu, 11 Feb 2021 15:55:21 +0000 (10:55 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 11 Feb 2021 15:55:21 +0000 (10:55 -0500)
On most systems where we compile e2fsprogs, the u64 type is an
unsigned long long.  However, there are platforms (such as the
PowerPC) where a long 64-bits and so u64 is typedef'ed to be unsigned
long instead of a unsigned long long.  Fix this by using explicit
casts in printf statements.  For scanf calls, we need to receive the
value into a unsigned long long, and then assign it to a u64, after
doing range checks.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
44 files changed:
debugfs/debugfs.c
debugfs/extent_inode.c
debugfs/filefrag.c
debugfs/htree.c
debugfs/icheck.c
debugfs/logdump.c
debugfs/ls.c
debugfs/lsdel.c
debugfs/unused.c
debugfs/zap.c
e2fsck/badblocks.c
e2fsck/ea_refcount.c
e2fsck/message.c
e2fsck/pass1.c
e2fsck/pass1b.c
e2fsck/problem.c
e2fsck/region.c
e2fsck/unix.c
e2fsck/util.c
lib/e2p/ls.c
lib/ext2fs/blkmap64_ba.c
lib/ext2fs/blkmap64_rb.c
lib/ext2fs/gen_bitmap64.c
lib/ext2fs/progress.c
lib/ext2fs/read_bb_file.c
lib/ext2fs/tst_bitmaps.c
lib/ext2fs/tst_iscan.c
lib/ext2fs/tst_libext2fs.c
lib/support/quotaio_v2.c
misc/badblocks.c
misc/dumpe2fs.c
misc/e2freefrag.c
misc/e2image.c
misc/e2undo.c
misc/e4defrag.c
misc/filefrag.c
misc/mk_hugefiles.c
misc/mke2fs.c
misc/tune2fs.c
resize/extent.c
resize/main.c
resize/online.c
resize/resize2fs.c
resize/test_extent.c

index 132c5f9..b67a88b 100644 (file)
@@ -493,11 +493,12 @@ void do_show_super_stats(int argc, char *argv[],
                        "inode table at %llu\n"
                        "           %u free %s%s, "
                        "%u free %s, "
-                       "%u used %s%s",
-                       i, ext2fs_block_bitmap_loc(current_fs, i),
-                       ext2fs_inode_bitmap_loc(current_fs, i),
-                       ext2fs_inode_table_loc(current_fs, i),
-                       ext2fs_bg_free_blocks_count(current_fs, i), units,
+                       "%u used %s%s", i,
+                       (unsigned long long) ext2fs_block_bitmap_loc(current_fs, i),
+                       (unsigned long long) ext2fs_inode_bitmap_loc(current_fs, i),
+                       (unsigned long long) ext2fs_inode_table_loc(current_fs, i),
+                       ext2fs_bg_free_blocks_count(current_fs, i),
+                       units,
                        ext2fs_bg_free_blocks_count(current_fs, i) != 1 ?
                        "s" : "",
                        ext2fs_bg_free_inodes_count(current_fs, i),
@@ -567,11 +568,13 @@ static void finish_range(struct list_blocks_struct *lb)
                fprintf(lb->f, ", ");
        if (lb->first_block == lb->last_block)
                fprintf(lb->f, "(%lld):%llu",
-                       (long long)lb->first_bcnt, lb->first_block);
+                       (long long)lb->first_bcnt,
+                       (unsigned long long) lb->first_block);
        else
                fprintf(lb->f, "(%lld-%lld):%llu-%llu",
                        (long long)lb->first_bcnt, (long long)lb->last_bcnt,
-                       lb->first_block, lb->last_block);
+                       (unsigned long long) lb->first_block,
+                       (unsigned long long) lb->last_block);
        lb->first_block = 0;
 }
 
@@ -721,18 +724,18 @@ static void dump_extents(FILE *f, const char *prefix, ext2_ino_t ino,
                                        info.curr_level, info.max_depth,
                                        info.curr_entry, info.num_entries,
                                        logical_width,
-                                       extent.e_lblk,
+                                       (unsigned long long) extent.e_lblk,
                                        logical_width,
-                                       extent.e_lblk + (extent.e_len - 1),
+                                       (unsigned long long) extent.e_lblk + (extent.e_len - 1),
                                        physical_width,
-                                       extent.e_pblk,
+                                       (unsigned long long) extent.e_pblk,
                                        physical_width+3, "", extent.e_len);
                                continue;
                        }
 
                        fprintf(f, "%s(ETB%d):%llu",
                                printed ? ", " : "", info.curr_level,
-                               extent.e_pblk);
+                               (unsigned long long) extent.e_pblk);
                        printed = 1;
                        continue;
                }
@@ -743,13 +746,13 @@ static void dump_extents(FILE *f, const char *prefix, ext2_ino_t ino,
                                info.curr_level, info.max_depth,
                                info.curr_entry, info.num_entries,
                                logical_width,
-                               extent.e_lblk,
+                               (unsigned long long) extent.e_lblk,
                                logical_width,
-                               extent.e_lblk + (extent.e_len - 1),
+                               (unsigned long long) extent.e_lblk + (extent.e_len - 1),
                                physical_width,
-                               extent.e_pblk,
+                               (unsigned long long) extent.e_pblk,
                                physical_width,
-                               extent.e_pblk + (extent.e_len - 1),
+                               (unsigned long long) extent.e_pblk + (extent.e_len - 1),
                                extent.e_len,
                                extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT ?
                                        "Uninit" : "");
@@ -762,20 +765,20 @@ static void dump_extents(FILE *f, const char *prefix, ext2_ino_t ino,
                        fprintf(f,
                                "%s(%lld%s):%lld",
                                printed ? ", " : "",
-                               extent.e_lblk,
+                               (unsigned long long) extent.e_lblk,
                                extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT ?
                                "[u]" : "",
-                               extent.e_pblk);
+                               (unsigned long long) extent.e_pblk);
                else
                        fprintf(f,
                                "%s(%lld-%lld%s):%lld-%lld",
                                printed ? ", " : "",
-                               extent.e_lblk,
-                               extent.e_lblk + (extent.e_len - 1),
+                               (unsigned long long) extent.e_lblk,
+                               (unsigned long long) extent.e_lblk + (extent.e_len - 1),
                                extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT ?
                                        "[u]" : "",
-                               extent.e_pblk,
-                               extent.e_pblk + (extent.e_len - 1));
+                               (unsigned long long) extent.e_pblk,
+                               (unsigned long long) extent.e_pblk + (extent.e_len - 1));
                printed = 1;
        }
        if (printed)
@@ -861,7 +864,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
                fprintf(out, "   Project: %5d", large_inode->i_projid);
        fputs("   Size: ", out);
        if (LINUX_S_ISREG(inode->i_mode) || LINUX_S_ISDIR(inode->i_mode))
-               fprintf(out, "%llu\n", EXT2_I_SIZE(inode));
+               fprintf(out, "%llu\n", (unsigned long long) EXT2_I_SIZE(inode));
        else
                fprintf(out, "%u\n", inode->i_size);
        if (os == EXT2_OS_HURD)
@@ -1085,7 +1088,7 @@ static int print_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
                             int ref_offset EXT2FS_ATTR((unused)),
                             void *private EXT2FS_ATTR((unused)))
 {
-       printf("%llu ", *blocknr);
+       printf("%llu ", (unsigned long long) *blocknr);
        return 0;
 }
 
@@ -1232,7 +1235,7 @@ void do_freeb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
        while (count-- > 0) {
                if (!ext2fs_test_block_bitmap2(current_fs->block_map,block))
                        com_err(argv[0], 0, "Warning: block %llu already clear",
-                               block);
+                               (unsigned long long) block);
                ext2fs_unmark_block_bitmap2(current_fs->block_map,block);
                block++;
        }
@@ -1252,7 +1255,7 @@ void do_setb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
        while (count-- > 0) {
                if (ext2fs_test_block_bitmap2(current_fs->block_map,block))
                        com_err(argv[0], 0, "Warning: block %llu already set",
-                               block);
+                               (unsigned long long) block);
                ext2fs_mark_block_bitmap2(current_fs->block_map,block);
                block++;
        }
@@ -1270,9 +1273,11 @@ void do_testb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
                return;
        while (count-- > 0) {
                if (ext2fs_test_block_bitmap2(current_fs->block_map,block))
-                       printf("Block %llu marked in use\n", block);
+                       printf("Block %llu marked in use\n",
+                              (unsigned long long) block);
                else
-                       printf("Block %llu not in use\n", block);
+                       printf("Block %llu not in use\n",
+                              (unsigned long long) block);
                block++;
        }
 }
@@ -1708,7 +1713,7 @@ void do_find_free_block(int argc, char *argv[],
                        com_err("ext2fs_new_block", retval, 0);
                        return;
                } else
-                       printf("%llu ", free_blk);
+                       printf("%llu ", (unsigned long long) free_blk);
        }
        printf("\n");
 }
@@ -2110,10 +2115,11 @@ void do_bmap(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
                               &ret_flags, &pblk);
        if (errcode) {
                com_err(argv[0], errcode,
-                       "while mapping logical block %llu\n", blk);
+                       "while mapping logical block %llu\n",
+                       (unsigned long long) blk);
                return;
        }
-       printf("%llu", pblk);
+       printf("%llu", (unsigned long long) pblk);
        if (ret_flags & BMAP_RET_UNINIT)
                fputs(" (uninit)", stdout);
        fputc('\n', stdout);
@@ -2447,17 +2453,19 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[],
        retval = ext2fs_mmp_read(current_fs, mmp_block, current_fs->mmp_buf);
        if (retval) {
                com_err(argv[0], retval, "reading MMP block %llu.\n",
-                       mmp_block);
+                       (unsigned long long) mmp_block);
                return;
        }
 
        t = mmp_s->mmp_time;
-       fprintf(stdout, "block_number: %llu\n", current_fs->super->s_mmp_block);
+       fprintf(stdout, "block_number: %llu\n",
+               (unsigned long long) current_fs->super->s_mmp_block);
        fprintf(stdout, "update_interval: %d\n",
                current_fs->super->s_mmp_update_interval);
        fprintf(stdout, "check_interval: %d\n", mmp_s->mmp_check_interval);
        fprintf(stdout, "sequence: %08x\n", mmp_s->mmp_seq);
-       fprintf(stdout, "time: %lld -- %s", mmp_s->mmp_time, ctime(&t));
+       fprintf(stdout, "time: %llu -- %s",
+               (unsigned long long) mmp_s->mmp_time, ctime(&t));
        fprintf(stdout, "node_name: %.*s\n",
                EXT2_LEN_STR(mmp_s->mmp_nodename));
        fprintf(stdout, "device_name: %.*s\n",
index 6706629..e4e815e 100644 (file)
@@ -33,8 +33,9 @@ static void dbg_print_extent(char *desc, struct ext2fs_extent *extent)
        if (desc)
                printf("%s: ", desc);
        printf("extent: lblk %llu--%llu, len %u, pblk %llu, flags: ",
-              extent->e_lblk, extent->e_lblk + extent->e_len - 1,
-              extent->e_len, extent->e_pblk);
+              (unsigned long long) extent->e_lblk,
+              (unsigned long long) extent->e_lblk + extent->e_len - 1,
+              extent->e_len, (unsigned long long) extent->e_pblk);
        if (extent->e_flags & EXT2_EXTENT_FLAGS_LEAF)
                fputs("LEAF ", stdout);
        if (extent->e_flags & EXT2_EXTENT_FLAGS_UNINIT)
@@ -527,8 +528,9 @@ void do_info(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
        printf("Current handle location: %d/%d (max: %d, bytes %d), level %d/%d\n",
               info.curr_entry, info.num_entries, info.max_entries,
               info.bytes_avail, info.curr_level, info.max_depth);
-       printf("\tmax lblk: %llu, max pblk: %llu\n", info.max_lblk,
-              info.max_pblk);
+       printf("\tmax lblk: %llu, max pblk: %llu\n",
+              (unsigned long long) info.max_lblk,
+              (unsigned long long) info.max_pblk);
        printf("\tmax_len: %u, max_uninit_len: %u\n", info.max_len,
               info.max_uninit_len);
 }
index 961b696..31c1440 100644 (file)
@@ -85,14 +85,17 @@ static void report_filefrag(struct filefrag_struct *fs)
                        fprintf(fs->f, "%4d %*lu %*llu %*llu %*lu\n", fs->ext,
                                fs->logical_width,
                                (unsigned long) fs->logical_start,
-                               fs->physical_width, fs->physical_start,
-                               fs->physical_width, fs->expected,
+                               fs->physical_width,
+                               (unsigned long long) fs->physical_start,
+                               fs->physical_width,
+                               (unsigned long long) fs->expected,
                                fs->logical_width, (unsigned long) fs->num);
                else
                        fprintf(fs->f, "%4d %*lu %*llu %*s %*lu\n", fs->ext,
                                fs->logical_width,
                                (unsigned long) fs->logical_start,
-                               fs->physical_width, fs->physical_start,
+                               fs->physical_width,
+                               (unsigned long long) fs->physical_start,
                                fs->physical_width, "",
                                fs->logical_width, (unsigned long) fs->num);
        }
@@ -150,7 +153,8 @@ static void filefrag(ext2_ino_t ino, struct ext2_inode *inode,
                        num_blocks /= current_fs->blocksize / 512;
 
                fprintf(fs->f, "\n%s has %llu block(s), i_size is %llu\n",
-                       fs->name, num_blocks, EXT2_I_SIZE(inode));
+                       fs->name, (unsigned long long) num_blocks,
+                       (unsigned long long) EXT2_I_SIZE(inode));
        }
        print_header(fs);
        if (ext2fs_inode_has_valid_blocks2(current_fs, inode)) {
index 23a9467..a9f9211 100644 (file)
@@ -53,16 +53,18 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino,
        errcode = ext2fs_bmap2(fs, ino, inode, buf, 0, blk, 0, &pblk);
        if (errcode) {
                com_err("htree_dump_leaf_node", errcode,
-                       "while mapping logical block %llu\n", blk);
+                       "while mapping logical block %llu\n",
+                       (unsigned long long) blk);
                return;
        }
 
-       fprintf(pager, "Reading directory block %llu, phys %llu\n", blk, pblk);
+       fprintf(pager, "Reading directory block %llu, phys %llu\n",
+               (unsigned long long) blk, (unsigned long long) pblk);
        errcode = ext2fs_read_dir_block4(current_fs, pblk, buf, 0, ino);
        if (errcode) {
                com_err("htree_dump_leaf_node", errcode,
                        "while reading block %llu (%llu)\n",
-                       blk, pblk);
+                       (unsigned long long) blk, (unsigned long long) pblk);
                return;
        }
        hash_alg = rootnode->hash_version;
@@ -85,7 +87,7 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino,
                    ((rec_len % 4) != 0) ||
                    ((unsigned) thislen + 8 > rec_len)) {
                        fprintf(pager, "Corrupted directory block (%llu)!\n",
-                               blk);
+                               (unsigned long long) blk);
                        break;
                }
                strncpy(name, dirent->name, thislen);
@@ -213,14 +215,16 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino,
        errcode = ext2fs_bmap2(fs, ino, inode, buf, 0, blk, 0, &pblk);
        if (errcode) {
                com_err("htree_dump_int_block", errcode,
-                       "while mapping logical block %llu\n", blk);
+                       "while mapping logical block %llu\n",
+                       (unsigned long long) blk);
                goto errout;
        }
 
        errcode = io_channel_read_blk64(current_fs->io, pblk, 1, buf);
        if (errcode) {
                com_err("htree_dump_int_block", errcode,
-                       "while reading block %llu\n", blk);
+                       "while reading block %llu\n",
+                       (unsigned long long) blk);
                goto errout;
        }
 
@@ -473,7 +477,7 @@ static int search_dir_block(ext2_filsys fs, blk64_t *blocknr,
                            p->len) == 0) {
                        printf("Entry found at logical block %lld, "
                               "phys %llu, offset %u\n", (long long)blockcnt,
-                              *blocknr, offset);
+                              (unsigned long long) *blocknr, offset);
                        printf("offset %u\n", offset);
                        return BLOCK_ABORT;
                }
index 71164cf..ed6e950 100644 (file)
@@ -159,10 +159,12 @@ void do_icheck(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
        printf("Block\tInode number\n");
        for (i=0, binfo = bw.barray; i < bw.num_blocks; i++, binfo++) {
                if (binfo->ino == 0) {
-                       printf("%llu\t<block not found>\n", binfo->blk);
+                       printf("%llu\t<block not found>\n",
+                              (unsigned long long) binfo->blk);
                        continue;
                }
-               printf("%llu\t%u\n", binfo->blk, binfo->ino);
+               printf("%llu\t%u\n", (unsigned long long) binfo->blk,
+                      binfo->ino);
        }
 
 error_out:
index 354bc96..56d6210 100644 (file)
@@ -177,7 +177,8 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
                                        * sizeof(struct ext2_inode));
                printf("Inode %u is at group %u, block %llu, offset %u\n",
                       inode_to_dump, inode_group,
-                      inode_block_to_dump, inode_offset_to_dump);
+                      (unsigned long long) inode_block_to_dump,
+                      inode_offset_to_dump);
        }
 
        if (optind == argc) {
@@ -541,7 +542,7 @@ static void dump_fc_block(FILE *out_file, char *buf, int blocksize,
                                le32_to_cpu(add_range->fc_ino),
                                le32_to_cpu(ex->ee_block),
                                le32_to_cpu(ex->ee_start) +
-                               (((__u64) le16_to_cpu(ex->ee_start_hi)) << 32),
+                               (((unsigned long long) le16_to_cpu(ex->ee_start_hi)) << 32),
                                le16_to_cpu(ex->ee_len) > EXT_INIT_MAX_LEN ?
                                le16_to_cpu(ex->ee_len) - EXT_INIT_MAX_LEN :
                                le16_to_cpu(ex->ee_len));
@@ -699,7 +700,8 @@ static void dump_revoke_block(FILE *out_file, char *buf,
                        rblock = ext2fs_be64_to_cpu(*entry);
                }
                if (dump_all || rblock == block_to_dump) {
-                       fprintf(out_file, "  Revoke FS block %llu", rblock);
+                       fprintf(out_file, "  Revoke FS block %llu",
+                               (unsigned long long) rblock);
                        if (dump_all)
                                fprintf(out_file, "\n");
                        else
@@ -783,7 +785,7 @@ static void dump_metadata_block(FILE *out_file, struct journal_source *source,
 
                fprintf(out_file, "    (block bitmap for block %llu: "
                        "block is %s)\n",
-                       block_to_dump,
+                       (unsigned long long) block_to_dump,
                        ext2fs_test_bit(offset, buf) ? "SET" : "CLEAR");
        }
 
index ae8b2d3..fae2a65 100644 (file)
@@ -118,7 +118,8 @@ static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
                if (LINUX_S_ISDIR(inode.i_mode))
                        fprintf(ls->f, "/");
                else
-                       fprintf(ls->f, "%lld/", EXT2_I_SIZE(&inode));
+                       fprintf(ls->f, "%llu/",
+                               (unsigned long long) EXT2_I_SIZE(&inode));
                fprintf(ls->f, "\n");
        } else if (options & LONG_OPT) {
                if (ino) {
@@ -143,7 +144,8 @@ static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
                fprintf(ls->f, "(%d)  %5d  %5d   ",
                        ext2fs_dirent_file_type(dirent),
                        inode_uid(inode), inode_gid(inode));
-                       fprintf(ls->f, "%5llu", EXT2_I_SIZE(&inode));
+                       fprintf(ls->f, "%5llu",
+                               (unsigned long long) EXT2_I_SIZE(&inode));
                fprintf(ls->f, " %s ", datestr);
                print_filename(ls->f, dirent, options);
                fputc('\n', ls->f);
index c0d5890..52c7419 100644 (file)
@@ -198,8 +198,10 @@ void do_lsdel(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
        for (i = 0; i < num_delarray; i++) {
                fprintf(out, "%6u %6d %6o %6llu %6lld/%6lld %s",
                        delarray[i].ino,
-                       delarray[i].uid, delarray[i].mode, delarray[i].size,
-                       delarray[i].free_blocks, delarray[i].num_blocks,
+                       delarray[i].uid, delarray[i].mode,
+                       (unsigned long long) delarray[i].size,
+                       (long long) delarray[i].free_blocks,
+                       (long long) delarray[i].num_blocks,
                        time_to_string(delarray[i].dtime));
        }
        fprintf(out, "%d deleted inodes found.\n", num_delarray);
index a6b44b5..08191a0 100644 (file)
@@ -53,7 +53,7 @@ void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv,
                if (i >= current_fs->blocksize)
                        continue;
                printf("\nUnused block %llu contains non-zero data:\n\n",
-                      blk);
+                      (unsigned long long) blk);
                for (i=0; i < current_fs->blocksize; i++)
                        fputc(buf[i], stdout);
        }
index f120377..f862482 100644 (file)
@@ -133,7 +133,8 @@ void do_zap_block(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
                                       block, 0, &block);
                if (errcode) {
                        com_err(argv[0], errcode,
-                               "while mapping logical block %llu\n", block);
+                               "while mapping logical block %llu\n",
+                               (unsigned long long) block);
                        return;
                }
        }
@@ -147,7 +148,8 @@ void do_zap_block(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
        errcode = io_channel_read_blk64(current_fs->io, block, 1, buf);
        if (errcode) {
                com_err(argv[0], errcode,
-                       "while reading block %llu\n", block);
+                       "while reading block %llu\n",
+                       (unsigned long long) block);
                goto errout;
        }
 
@@ -159,7 +161,8 @@ void do_zap_block(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
        errcode = io_channel_write_blk64(current_fs->io, block, 1, buf);
        if (errcode) {
                com_err(argv[0], errcode,
-                       "while write block %llu\n", block);
+                       "while write block %llu\n",
+                       (unsigned long long) block);
                goto errout;
        }
 
@@ -214,7 +217,8 @@ void do_block_dump(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
                                       block, 0, &block);
                if (errcode) {
                        com_err(argv[0], errcode,
-                               "while mapping logical block %llu\n", block);
+                               "while mapping logical block %llu\n",
+                               (unsigned long long) block);
                        return;
                }
        }
@@ -228,7 +232,8 @@ void do_block_dump(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
        errcode = io_channel_read_blk64(current_fs->io, block, 1, buf);
        if (errcode) {
                com_err(argv[0], errcode,
-                       "while reading block %llu\n", block);
+                       "while reading block %llu\n",
+                       (unsigned long long) block);
                goto errout;
        }
 
index 7f3641b..fec5f10 100644 (file)
@@ -76,7 +76,8 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
                sprintf(buf, "badblocks -b %d -X %s%s%s %llu", fs->blocksize,
                        (ctx->options & E2F_OPT_PREEN) ? "" : "-s ",
                        (ctx->options & E2F_OPT_WRITECHECK) ? "-n " : "",
-                       fs->device_name, ext2fs_blocks_count(fs->super)-1);
+                       fs->device_name,
+                       (unsigned long long) ext2fs_blocks_count(fs->super)-1);
                f = popen(buf, "r");
                if (!f) {
                        com_err("read_bad_blocks_file", errno,
index aa5d7d7..7154b47 100644 (file)
@@ -313,8 +313,10 @@ errcode_t ea_refcount_validate(ext2_refcount_t refcount, FILE *out)
                if (refcount->list[i-1].ea_key >= refcount->list[i].ea_key) {
                        fprintf(out,
                                "%s: list[%d].ea_key=%llu, list[%d].ea_key=%llu\n",
-                               bad, i-1, refcount->list[i-1].ea_key, i,
-                               refcount->list[i].ea_key);
+                               bad, i-1,
+                               (unsigned long long) refcount->list[i-1].ea_key,
+                               i,
+                               (unsigned long long) refcount->list[i].ea_key);
                        ret = EXT2_ET_INVALID_ARGUMENT;
                }
        }
@@ -399,22 +401,26 @@ int main(int argc, char **argv)
                case BCODE_STORE:
                        ea_key = (size_t) bcode_program[i++];
                        arg = bcode_program[i++];
-                       printf("Storing ea_key %llu with value %llu\n", ea_key,
-                              arg);
+                       printf("Storing ea_key %llu with value %llu\n",
+                              (unsigned long long) ea_key,
+                              (unsigned long long) arg);
                        retval = ea_refcount_store(refcount, ea_key, arg);
                        if (retval)
                                com_err("ea_refcount_store", retval,
-                                       "while storing ea_key %llu", ea_key);
+                                       "while storing ea_key %llu",
+                                       (unsigned long long) ea_key);
                        break;
                case BCODE_FETCH:
                        ea_key = (size_t) bcode_program[i++];
                        retval = ea_refcount_fetch(refcount, ea_key, &arg);
                        if (retval)
                                com_err("ea_refcount_fetch", retval,
-                                       "while fetching ea_key %llu", ea_key);
+                                       "while fetching ea_key %llu",
+                                       (unsigned long long) ea_key);
                        else
                                printf("bcode_fetch(%llu) returns %llu\n",
-                                      ea_key, arg);
+                                      (unsigned long long) ea_key,
+                                      (unsigned long long) arg);
                        break;
                case BCODE_INCR:
                        ea_key = (size_t) bcode_program[i++];
@@ -422,10 +428,11 @@ int main(int argc, char **argv)
                        if (retval)
                                com_err("ea_refcount_increment", retval,
                                        "while incrementing ea_key %llu",
-                                       ea_key);
+                                       (unsigned long long) ea_key);
                        else
                                printf("bcode_increment(%llu) returns %llu\n",
-                                      ea_key, arg);
+                                      (unsigned long long) ea_key,
+                                      (unsigned long long) arg);
                        break;
                case BCODE_DECR:
                        ea_key = (size_t) bcode_program[i++];
@@ -433,10 +440,11 @@ int main(int argc, char **argv)
                        if (retval)
                                com_err("ea_refcount_decrement", retval,
                                        "while decrementing ea_key %llu",
-                                       ea_key);
+                                       (unsigned long long) ea_key);
                        else
                                printf("bcode_decrement(%llu) returns %llu\n",
-                                      ea_key, arg);
+                                      (unsigned long long) ea_key,
+                                      (unsigned long long) arg);
                        break;
                case BCODE_VALIDATE:
                        retval = ea_refcount_validate(refcount, stderr);
@@ -452,8 +460,9 @@ int main(int argc, char **argv)
                                ea_key = ea_refcount_intr_next(refcount, &arg);
                                if (!ea_key)
                                        break;
-                               printf("\tea_key=%llu, count=%llu\n", ea_key,
-                                      arg);
+                               printf("\tea_key=%llu, count=%llu\n",
+                                      (unsigned long long) ea_key,
+                                      (unsigned long long) arg);
                        }
                        break;
                case BCODE_COLLAPSE:
index 05d914d..ba38038 100644 (file)
@@ -281,7 +281,7 @@ static _INLINE_ void expand_inode_expression(FILE *f, ext2_filsys fs, char ch,
 
        switch (ch) {
        case 's':
-               fprintf(f, "%llu", EXT2_I_SIZE(inode));
+               fprintf(f, "%llu", (unsigned long long) EXT2_I_SIZE(inode));
                break;
        case 'S':
                fprintf(f, "%u", large_inode->i_extra_isize);
@@ -307,7 +307,8 @@ static _INLINE_ void expand_inode_expression(FILE *f, ext2_filsys fs, char ch,
                fprintf(f, "%u", inode->i_faddr);
                break;
        case 'f':
-               fprintf(f, "%llu", ext2fs_file_acl_block(fs, inode));
+               fprintf(f, "%llu",
+                       (unsigned long long) ext2fs_file_acl_block(fs, inode));
                break;
        case 'd':
                fprintf(f, "%u", (LINUX_S_ISDIR(inode->i_mode) ?
@@ -462,7 +463,9 @@ static _INLINE_ void expand_percent_expression(FILE *f, ext2_filsys fs,
                fprintf(f, "%*lld", width, (long long) ctx->blkcount);
                break;
        case 'S':
-               fprintf(f, "%llu", get_backup_sb(NULL, fs, NULL, NULL));
+               fprintf(f, "%llu",
+                       (unsigned long long) get_backup_sb(NULL, fs,
+                                                          NULL, NULL));
                break;
        case 's':
                fprintf(f, "%*s", width, ctx->str ? ctx->str : "NULL");
index 7d39097..a1e24e5 100644 (file)
@@ -2898,9 +2898,10 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
                if (is_leaf && problem == 0 && extent.e_len > 0) {
 #if 0
                        printf("extent_region(ino=%u, expect=%llu, "
-                              "lblk=%llu, len=%u)\n",
-                              pb->ino, pb->next_lblock,
-                              extent.e_lblk, extent.e_len);
+                              "lblk=%llu, len=%u)\n", pb->ino,
+                              (unsigned long long) pb->next_lblock,
+                              (unsigned long long) extent.e_lblk,
+                              extent.e_len);
 #endif
                        if (extent.e_lblk < pb->next_lblock)
                                problem = PR_1_EXTENT_COLLISION;
@@ -3495,8 +3496,9 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
        pb.num_blocks *= EXT2FS_CLUSTER_RATIO(fs);
 #if 0
        printf("inode %u, i_size = %u, last_block = %llu, i_blocks=%llu, num_blocks = %llu\n",
-              ino, inode->i_size, pb.last_block, ext2fs_inode_i_blocks(fs, inode),
-              pb.num_blocks);
+              ino, inode->i_size, (unsigned long long) pb.last_block,
+              (unsigned long long) ext2fs_inode_i_blocks(fs, inode),
+              (unsigned long long) pb.num_blocks);
 #endif
        size = EXT2_I_SIZE(inode);
        if (pb.is_dir) {
@@ -3721,7 +3723,7 @@ static int process_block(ext2_filsys fs,
                                       (unsigned long) pctx->ino, type,
                                       (unsigned long) p->previous_block+1,
                                       (unsigned long) blk,
-                                      blockcnt);
+                                      (long long) blockcnt);
                        }
                        p->fragmented = 1;
                }
index 2f8c14c..656a275 100644 (file)
@@ -670,7 +670,7 @@ static int delete_file_block(ext2_filsys fs,
                } else
                        com_err("delete_file_block", 0,
                            _("internal error: can't find dup_blk for %llu\n"),
-                               *block_nr);
+                               (unsigned long long) *block_nr);
        } else {
                if ((*block_nr % EXT2FS_CLUSTER_RATIO(ctx->fs)) == 0)
                        ext2fs_block_alloc_stats2(fs, *block_nr, -1);
@@ -828,7 +828,7 @@ static int clone_file_block(ext2_filsys fs,
                if (!n) {
                        com_err("clone_file_block", 0,
                            _("internal error: can't find dup_blk for %llu\n"),
-                               *block_nr);
+                               (unsigned long long) *block_nr);
                        return 0;
                }
 
@@ -878,7 +878,8 @@ cluster_alloc_ok:
                }
 #if 0
                printf("Cloning block #%lld from %llu to %llu\n",
-                      blockcnt, *block_nr, new_block);
+                      blockcnt, (unsigned long long) *block_nr,
+                      (unsigned long long) new_block);
 #endif
                retval = io_channel_read_blk64(fs->io, *block_nr, 1, cs->buf);
                if (retval) {
@@ -978,7 +979,8 @@ static errcode_t clone_file(e2fsck_t ctx, ext2_ino_t ino,
                if (!n) {
                        com_err("clone_file", 0,
                                _("internal error: couldn't lookup EA "
-                                 "block record for %llu"), blk);
+                                 "block record for %llu"),
+                               (unsigned long long) blk);
                        retval = 0; /* OK to stumble on... */
                        goto errout;
                }
index 8d90739..eb2824f 100644 (file)
@@ -2386,11 +2386,11 @@ static void print_problem(FILE *f, problem_t code, int answer, int fixed,
        if (pctx->dir)
                fprintf(f, " dir=\"%u\"", pctx->dir);
        if (pctx->blk)
-               fprintf(f, " blk=\"%llu\"", pctx->blk);
+               fprintf(f, " blk=\"%llu\"", (unsigned long long) pctx->blk);
        if (pctx->blk2)
-               fprintf(f, " blk2=\"%llu\"", pctx->blk2);
+               fprintf(f, " blk2=\"%llu\"", (unsigned long long) pctx->blk2);
        if (pctx->blkcount != (e2_blkcnt_t) -1)
-               fprintf(f, " blkcount=\"%lld\"", pctx->blkcount);
+               fprintf(f, " blkcount=\"%lld\"", (unsigned long long) pctx->blkcount);
        if (pctx->group != (dgrp_t) -1)
                fprintf(f, " group=\"%u\"", pctx->group);
        if (pctx->csum1)
@@ -2398,9 +2398,9 @@ static void print_problem(FILE *f, problem_t code, int answer, int fixed,
        if (pctx->csum2)
                fprintf(f, " csum2=\"%u\"", pctx->csum2);
        if (pctx->num)
-               fprintf(f, " num=\"%llu\"", pctx->num);
+               fprintf(f, " num=\"%llu\"", (unsigned long long) pctx->num);
        if (pctx->num2)
-               fprintf(f, " num2=\"%llu\"", pctx->num2);
+               fprintf(f, " num2=\"%llu\"", (unsigned long long) pctx->num2);
        if (pctx->str)
                fprintf(f, " str=\"%s\"", pctx->str);
        fputs("/>\n", f);
index 788e0d0..698f7bd 100644 (file)
@@ -180,10 +180,13 @@ void region_print(region_t region, FILE *f)
        struct region_el        *r;
        int     i = 0;
 
-       fprintf(f, "Printing region (min=%llu. max=%llu)\n\t", region->min,
-               region->max);
+       fprintf(f, "Printing region (min=%llu. max=%llu)\n\t",
+               (unsigned long long) region->min,
+               (unsigned long long) region->max);
        for (r = region->allocated; r; r = r->next) {
-               fprintf(f, "(%llu, %llu)  ", r->start, r->end);
+               fprintf(f, "(%llu, %llu)  ",
+                       (unsigned long long) r->start,
+                       (unsigned long long) r->end);
                if (++i >= 8)
                        fprintf(f, "\n\t");
        }
@@ -205,7 +208,8 @@ int main(int argc, char **argv)
                        start = bcode_program[pc++];
                        end = bcode_program[pc++];
                        printf("Creating region with args(%llu, %llu)\n",
-                              start, end);
+                              (unsigned long long) start,
+                              (unsigned long long) end);
                        r = region_create(start, end);
                        if (!r) {
                                fprintf(stderr, "Couldn't create region.\n");
@@ -217,7 +221,8 @@ int main(int argc, char **argv)
                        end = bcode_program[pc++];
                        ret = region_allocate(r, start, end);
                        printf("Region_allocate(%llu, %llu) returns %d\n",
-                              start, end, ret);
+                              (unsigned long long) start,
+                              (unsigned long long) end, ret);
                        break;
                case BCODE_PRINT:
                        region_print(r, stdout);
index 08f1863..c5f9e44 100644 (file)
@@ -138,7 +138,8 @@ static void show_stats(e2fsck_t     ctx)
                               "%llu/%llu blocks\n"),
                        ctx->device_name, inodes_used, inodes,
                        frag_percent_total / 10, frag_percent_total % 10,
-                       blocks_used, blocks);
+                       (unsigned long long) blocks_used,
+                       (unsigned long long) blocks);
                return;
        }
        profile_get_boolean(ctx->profile, "options", "report_features", 0, 0,
@@ -194,7 +195,8 @@ static void show_stats(e2fsck_t     ctx)
        log_out(ctx, P_("%12llu block used (%2.2f%%, out of %llu)\n",
                        "%12llu blocks used (%2.2f%%, out of %llu)\n",
                   blocks_used),
-               blocks_used, 100.0 * blocks_used / blocks, blocks);
+               (unsigned long long) blocks_used, 100.0 * blocks_used / blocks,
+               (unsigned long long) blocks);
        log_out(ctx, P_("%12u bad block\n", "%12u bad blocks\n",
                        ctx->fs_badblocks_count), ctx->fs_badblocks_count);
        log_out(ctx, P_("%12u large file\n", "%12u large files\n",
@@ -444,9 +446,9 @@ static void check_if_skip(e2fsck_t ctx)
                ctx->device_name,
                fs->super->s_inodes_count - fs->super->s_free_inodes_count,
                fs->super->s_inodes_count,
-               ext2fs_blocks_count(fs->super) -
+               (unsigned long long) ext2fs_blocks_count(fs->super) -
                ext2fs_free_blocks_count(fs->super),
-               ext2fs_blocks_count(fs->super));
+               (unsigned long long) ext2fs_blocks_count(fs->super));
        next_check = 100000;
        if (fs->super->s_max_mnt_count > 0) {
                next_check = fs->super->s_max_mnt_count - fs->super->s_mnt_count;
@@ -821,7 +823,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
 #ifdef CONFIG_JBD_DEBUG
        char            *jbd_debug;
 #endif
-       unsigned long long phys_mem_kb;
+       unsigned long long phys_mem_kb, blk;
 
        retval = e2fsck_allocate_context(&ctx);
        if (retval)
@@ -922,7 +924,8 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                        /* What we do by default, anyway! */
                        break;
                case 'b':
-                       res = sscanf(optarg, "%llu", &ctx->use_superblock);
+                       res = sscanf(optarg, "%llu", &blk);
+                       ctx->use_superblock = blk;
                        if (res != 1)
                                goto sscanf_err;
                        ctx->flags |= E2F_FLAG_SB_SPECIFIED;
index 0a7cafe..3fe3c98 100644 (file)
@@ -771,7 +771,8 @@ void dump_mmp_msg(struct mmp_struct *mmp, const char *fmt, ...)
                       mmp->mmp_check_interval);
                printf("    mmp_sequence: %08x\n", mmp->mmp_seq);
                printf("    mmp_update_date: %s", ctime(&t));
-               printf("    mmp_update_time: %lld\n", mmp->mmp_time);
+               printf("    mmp_update_time: %lld\n",
+                      (long long) mmp->mmp_time);
                printf("    mmp_node_name: %.*s\n",
                       EXT2_LEN_STR(mmp->mmp_nodename));
                printf("    mmp_device_name: %.*s\n",
index 5aad15d..176bee0 100644 (file)
@@ -269,12 +269,15 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
        fprintf(f, "Filesystem OS type:       %s\n", str);
        free(str);
        fprintf(f, "Inode count:              %u\n", sb->s_inodes_count);
-       fprintf(f, "Block count:              %llu\n", e2p_blocks_count(sb));
-       fprintf(f, "Reserved block count:     %llu\n", e2p_r_blocks_count(sb));
+       fprintf(f, "Block count:              %llu\n",
+               (unsigned long long) e2p_blocks_count(sb));
+       fprintf(f, "Reserved block count:     %llu\n",
+               (unsigned long long) e2p_r_blocks_count(sb));
        if (sb->s_overhead_clusters)
                fprintf(f, "Overhead clusters:        %u\n",
                        sb->s_overhead_clusters);
-       fprintf(f, "Free blocks:              %llu\n", e2p_free_blocks_count(sb));
+       fprintf(f, "Free blocks:              %llu\n",
+               (unsigned long long) e2p_free_blocks_count(sb));
        fprintf(f, "Free inodes:              %u\n", sb->s_free_inodes_count);
        fprintf(f, "First block:              %u\n", sb->s_first_data_block);
        fprintf(f, "Block size:               %u\n", EXT2_BLOCK_SIZE(sb));
@@ -336,18 +339,19 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
        if (sb->s_kbytes_written) {
                fprintf(f, "Lifetime writes:          ");
                if (sb->s_kbytes_written < POW2(13))
-                       fprintf(f, "%llu kB\n", sb->s_kbytes_written);
+                       fprintf(f, "%llu kB\n",
+                               (unsigned long long) sb->s_kbytes_written);
                else if (sb->s_kbytes_written < POW2(23))
-                       fprintf(f, "%llu MB\n",
-                               (sb->s_kbytes_written + POW2(9)) >> 10);
+                 fprintf(f, "%llu MB\n", (unsigned long long)
+                         (sb->s_kbytes_written + POW2(9)) >> 10);
                else if (sb->s_kbytes_written < POW2(33))
-                       fprintf(f, "%llu GB\n",
+                 fprintf(f, "%llu GB\n", (unsigned long long)
                                (sb->s_kbytes_written + POW2(19)) >> 20);
                else if (sb->s_kbytes_written < POW2(43))
-                       fprintf(f, "%llu TB\n",
+                       fprintf(f, "%llu TB\n", (unsigned long long)
                                (sb->s_kbytes_written + POW2(29)) >> 30);
                else
-                       fprintf(f, "%llu PB\n",
+                       fprintf(f, "%llu PB\n", (unsigned long long)
                                (sb->s_kbytes_written + POW2(39)) >> 40);
        }
        fprintf(f, "Reserved blocks uid:      ");
@@ -407,7 +411,7 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
                fprintf(f, "Snapshot ID:              %u\n",
                        sb->s_snapshot_id);
                fprintf(f, "Snapshot reserved blocks: %llu\n",
-                       sb->s_snapshot_r_blocks_count);
+                       (unsigned long long) sb->s_snapshot_r_blocks_count);
        }
        if (sb->s_snapshot_list)
                fprintf(f, "Snapshot list head:       %u\n",
@@ -427,7 +431,7 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
                                sb->s_first_error_ino);
                if (sb->s_first_error_block)
                        fprintf(f, "First error block #:      %llu\n",
-                               sb->s_first_error_block);
+                               (unsigned long long) sb->s_first_error_block);
                if (sb->s_first_error_errcode)
                        fprintf(f, "First error err:          %s\n",
                                e2p_errcode2str(sb->s_first_error_errcode));
@@ -444,14 +448,14 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
                                sb->s_last_error_ino);
                if (sb->s_last_error_block)
                        fprintf(f, "Last error block #:       %llu\n",
-                               sb->s_last_error_block);
+                               (unsigned long long) sb->s_last_error_block);
                if (sb->s_last_error_errcode)
                        fprintf(f, "Last error err:           %s\n",
                                e2p_errcode2str(sb->s_last_error_errcode));
        }
        if (ext2fs_has_feature_mmp(sb)) {
                fprintf(f, "MMP block number:         %llu\n",
-                       (long long)sb->s_mmp_block);
+                       (unsigned long long) sb->s_mmp_block);
                fprintf(f, "MMP update interval:      %u\n",
                        sb->s_mmp_update_interval);
        }
index 85cb38d..5d8f154 100644 (file)
@@ -313,7 +313,7 @@ static void ba_clear_bmap(ext2fs_generic_bitmap_64 bitmap)
 #ifdef ENABLE_BMAP_STATS
 static void ba_print_stats(ext2fs_generic_bitmap_64 bitmap)
 {
-       fprintf(stderr, "%16llu Bytes used by bitarray\n",
+       fprintf(stderr, "%16llu Bytes used by bitarray\n", (unsigned long long)
                ((bitmap->real_end - bitmap->start) >> 3) + 1 +
                sizeof(struct ext2fs_ba_private_struct));
 }
index 1fd5527..0df58dc 100644 (file)
@@ -80,7 +80,8 @@ static void print_tree(struct rb_root *root)
             node = ext2fs_rb_next(node)) {
                ext = node_to_extent(node);
                fprintf(stderr, "\t\t\t--> (%llu -> %llu)\n",
-                       ext->start, ext->start + ext->count);
+                       (unsigned long long) ext->start,
+                       (unsigned long long) ext->start + ext->count);
        }
        fprintf(stderr, "\t\t\t=================================\n");
 }
@@ -96,16 +97,18 @@ static void check_tree(struct rb_root *root, const char *msg)
                if (ext->count == 0) {
                        fprintf(stderr, "Tree Error: count is zero\n");
                        fprintf(stderr, "extent: %llu -> %llu (%llu)\n",
-                               ext->start, ext->start + ext->count,
-                               ext->count);
+                               (unsigned long long) ext->start,
+                               (unsigned long long) ext->start + ext->count,
+                               (unsigned long long) ext->count);
                        goto err_out;
                }
                if (ext->start + ext->count < ext->start) {
                        fprintf(stderr,
                                "Tree Error: start or count is crazy\n");
                        fprintf(stderr, "extent: %llu -> %llu (%llu)\n",
-                               ext->start, ext->start + ext->count,
-                               ext->count);
+                               (unsigned long long) ext->start,
+                               (unsigned long long) ext->start + ext->count,
+                               (unsigned long long) ext->count);
                        goto err_out;
                }
 
@@ -113,24 +116,28 @@ static void check_tree(struct rb_root *root, const char *msg)
                        if (old->start > ext->start) {
                                fprintf(stderr, "Tree Error: start is crazy\n");
                                fprintf(stderr, "extent: %llu -> %llu (%llu)\n",
-                                       old->start, old->start + old->count,
-                                       old->count);
+                                       (unsigned long long) old->start,
+                                       (unsigned long long) old->start + old->count,
+                                       (unsigned long long) old->count);
                                fprintf(stderr,
                                        "extent next: %llu -> %llu (%llu)\n",
-                                       ext->start, ext->start + ext->count,
-                                       ext->count);
+                                       (unsigned long long) ext->start,
+                                       (unsigned long long) ext->start + ext->count,
+                                       (unsigned long long) ext->count);
                                goto err_out;
                        }
                        if ((old->start + old->count) >= ext->start) {
                                fprintf(stderr,
                                        "Tree Error: extent is crazy\n");
                                fprintf(stderr, "extent: %llu -> %llu (%llu)\n",
-                                       old->start, old->start + old->count,
-                                       old->count);
+                                       (unsigned long long) old->start,
+                                       (unsigned long long) old->start + old->count,
+                                       (unsigned long long) old->count);
                                fprintf(stderr,
                                        "extent next: %llu -> %llu (%llu)\n",
-                                       ext->start, ext->start + ext->count,
-                                       ext->count);
+                                       (unsigned long long) ext->start,
+                                       (unsigned long long) ext->start + ext->count,
+                                       (unsigned long long) ext->count);
                                goto err_out;
                        }
                }
@@ -949,15 +956,17 @@ static void rb_print_stats(ext2fs_generic_bitmap_64 bitmap)
                bp->test_hit, t_hit, bp->mark_hit, m_hit);
 #endif
        fprintf(stderr, "%16llu extents (%llu bytes)\n",
-               count, ((count * sizeof(struct bmap_rb_extent)) +
-                       sizeof(struct ext2fs_rb_private)));
+               (unsigned long long) count, (unsigned long long)
+               ((count * sizeof(struct bmap_rb_extent)) +
+                sizeof(struct ext2fs_rb_private)));
        fprintf(stderr, "%16llu bits minimum size\n",
-               min_size);
+               (unsigned long long) min_size);
        fprintf(stderr, "%16llu bits maximum size\n"
                "%16llu bits average size\n",
-               max_size, avg_size);
-       fprintf(stderr, "%16llu bits set in bitmap (out of %llu)\n", size,
-               bitmap->real_end - bitmap->start);
+               (unsigned long long) max_size, (unsigned long long) avg_size);
+       fprintf(stderr, "%16llu bits set in bitmap (out of %llu)\n",
+               (unsigned long long) size,
+               (unsigned long long) bitmap->real_end - bitmap->start);
        fprintf(stderr,
                "%16.4lf memory / bitmap bit memory ratio (bitarray = 1)\n",
                eff);
index b237066..a2b8989 100644 (file)
@@ -74,9 +74,11 @@ static void warn_bitmap(ext2fs_generic_bitmap_64 bitmap,
 #ifndef OMIT_COM_ERR
        if (bitmap->description)
                com_err(0, bitmap->base_error_code+code,
-                       "#%llu for %s", arg, bitmap->description);
+                       "#%llu for %s", (unsigned long long) arg,
+                       bitmap->description);
        else
-               com_err(0, bitmap->base_error_code + code, "#%llu", arg);
+               com_err(0, bitmap->base_error_code + code, "#%llu",
+                       (unsigned long long) arg);
 #endif
 }
 
index 83556b1..fe4292f 100644 (file)
@@ -85,8 +85,8 @@ void ext2fs_numeric_progress_update(ext2_filsys fs,
                return;
        last_update = now;
 
-       printf("%*llu/%*llu", progress->log_max, val,
-              progress->log_max, progress->max);
+       printf("%*llu/%*llu", progress->log_max, (unsigned long long) val,
+              progress->log_max, (unsigned long long) progress->max);
        fprintf(stdout, "%.*s", (2*progress->log_max)+1, backspaces);
 }
 
index 8d1ad1a..a6d3beb 100644 (file)
@@ -39,7 +39,7 @@ errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
                                               void *priv_data))
 {
        errcode_t       retval;
-       blk64_t         blockno;
+       unsigned long long blockno;
        int             count;
        char            buf[128];
 
@@ -65,10 +65,10 @@ errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
                    ((blockno < fs->super->s_first_data_block) ||
                     (blockno >= ext2fs_blocks_count(fs->super)))) {
                        if (invalid)
-                               (invalid)(fs, blockno, buf, priv_data);
+                               (invalid)(fs, (blk64_t) blockno, buf, priv_data);
                        continue;
                }
-               retval = ext2fs_badblocks_list_add(*bb_list, blockno);
+               retval = ext2fs_badblocks_list_add(*bb_list, (blk64_t) blockno);
                if (retval)
                        return retval;
        }
index f6196b3..cb3c70d 100644 (file)
@@ -439,7 +439,7 @@ void do_ffzb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
                       error_message(retval));
                return;
        }
-       printf("First unmarked block is %llu\n", out);
+       printf("First unmarked block is %llu\n", (unsigned long long) out);
 }
 
 void do_ffsb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
@@ -473,7 +473,7 @@ void do_ffsb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
                       error_message(retval));
                return;
        }
-       printf("First marked block is %llu\n", out);
+       printf("First marked block is %llu\n", (unsigned long long) out);
 }
 
 
index 70bfbec..76aaa9a 100644 (file)
@@ -182,7 +182,8 @@ static void check_map(void)
 
        for (i=0; test_vec[i]; i++) {
                if (ext2fs_test_block_bitmap2(touched_map, test_vec[i])) {
-                       printf("Bad block was touched --- %llu\n", test_vec[i]);
+                       printf("Bad block was touched --- %llu\n",
+                              (unsigned long long) test_vec[i]);
                        failed++;
                        first_no_comma = 1;
                }
@@ -194,7 +195,8 @@ static void check_map(void)
                     j++, blk++) {
                        if (!ext2fs_test_block_bitmap2(touched_map, blk) &&
                            !ext2fs_test_block_bitmap2(bad_block_map, blk)) {
-                               printf("Missing block --- %llu\n", blk);
+                               printf("Missing block --- %llu\n",
+                                      (unsigned long long) blk);
                                failed++;
                        }
                }
index 3e7497c..4c86464 100644 (file)
@@ -38,7 +38,8 @@ static int print_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
                             void *private EXT2FS_ATTR((unused)))
 {
        printf("%6lld %8llu (%d %llu)\n", (long long) blockcnt,
-              (unsigned long long)*blocknr, ref_offset, ref_block);
+              (unsigned long long) *blocknr, ref_offset,
+              (unsigned long long) ref_block);
        return 0;
 }
 
index 7390667..23717f0 100644 (file)
@@ -197,7 +197,8 @@ static int v2_init_io(struct quota_handle *h)
             (filesize + QT_BLKSIZE - 1) >> QT_BLKSIZE_BITS)) {
                log_err("Quota inode %u corrupted: file size %llu; "
                        "dqi_blocks %u", h->qh_qf.ino,
-                       filesize, info->dqi_qtree.dqi_blocks);
+                       (unsigned long long) filesize,
+                       info->dqi_qtree.dqi_blocks);
                return -1;
        }
        if (info->dqi_qtree.dqi_free_blk >= info->dqi_qtree.dqi_blocks) {
index abf315c..b48d490 100644 (file)
@@ -1066,7 +1066,7 @@ int main (int argc, char ** argv)
                                  unsigned int);
        int open_flag;
        long sysval;
-       blk64_t inblk;
+       unsigned long long inblk;
 
        setbuf(stdout, NULL);
        setbuf(stderr, NULL);
@@ -1231,14 +1231,15 @@ int main (int argc, char ** argv)
        } else first_block = 0;
        if (first_block >= last_block) {
            com_err (program_name, 0, _("invalid starting block (%llu): must be less than %llu"),
-                    first_block, last_block);
+                    (unsigned long long) first_block,
+                    (unsigned long long) last_block);
            exit (1);
        }
        /* ext2 badblocks file can't handle large values */
        if (last_block >> 32) {
                com_err(program_name, EOVERFLOW,
                        _("invalid end block (%llu): must be 32-bit value"),
-                       last_block);
+                       (unsigned long long) last_block);
                exit(1);
        }
        if (w_flag)
index 4ea1ac8..3f4fc4e 100644 (file)
@@ -196,9 +196,9 @@ static void list_desc(ext2_filsys fs, int grp_only)
                                          &old_desc_blk, &new_desc_blk, 0);
 
                if (grp_only) {
-                       printf("%lu:%llu:", i, first_block);
+                       printf("%lu:%llu:", i, (unsigned long long) first_block);
                        if (i == 0 || super_blk)
-                               printf("%llu:", super_blk);
+                               printf("%llu:", (unsigned long long) super_blk);
                        else
                                printf("-1:");
                        if (old_desc_blk) {
@@ -206,13 +206,13 @@ static void list_desc(ext2_filsys fs, int grp_only)
                                            old_desc_blk + old_desc_blocks - 1);
                                printf(":");
                        } else if (new_desc_blk)
-                               printf("%llu:", new_desc_blk);
+                               printf("%llu:", (unsigned long long) new_desc_blk);
                        else
                                printf("-1:");
                        printf("%llu:%llu:%llu\n",
-                              ext2fs_block_bitmap_loc(fs, i),
-                              ext2fs_inode_bitmap_loc(fs, i),
-                              ext2fs_inode_table_loc(fs, i));
+                              (unsigned long long) ext2fs_block_bitmap_loc(fs, i),
+                              (unsigned long long) ext2fs_inode_bitmap_loc(fs, i),
+                              (unsigned long long) ext2fs_inode_table_loc(fs, i));
                        continue;
                }
 
@@ -485,7 +485,8 @@ static void print_mmp_block(ext2_filsys fs)
        if (retval) {
                com_err(program_name, retval,
                        _("reading MMP block %llu from '%s'\n"),
-                       fs->super->s_mmp_block, fs->device_name);
+                       (unsigned long long) fs->super->s_mmp_block,
+                       fs->device_name);
                return;
        }
 
@@ -496,7 +497,8 @@ static void print_mmp_block(ext2_filsys fs)
        printf("    mmp_check_interval: %d\n", mmp->mmp_check_interval);
        printf("    mmp_sequence: %#08x\n", mmp->mmp_seq);
        printf("    mmp_update_date: %s", ctime(&mmp_time));
-       printf("    mmp_update_time: %lld\n", mmp->mmp_time);
+       printf("    mmp_update_time: %llu\n",
+              (unsigned long long) mmp->mmp_time);
        printf("    mmp_node_name: %.*s\n",
               EXT2_LEN_STR(mmp->mmp_nodename));
        printf("    mmp_device_name: %.*s\n",
index a9d16fc..49b6346 100644 (file)
@@ -265,8 +265,8 @@ static errcode_t dump_chunk_info(ext2_filsys fs, struct chunk_info *info,
        int i, retval = 0;
 
        fprintf(f, "Total blocks: %llu\nFree blocks: %llu (%0.1f%%)\n",
-               ext2fs_blocks_count(fs->super),
-               free_blks,
+               (unsigned long long) ext2fs_blocks_count(fs->super),
+               (unsigned long long) free_blks,
                (double)free_blks * 100 /
                ext2fs_blocks_count(fs->super));
 
index e5e4756..90a34be 100644 (file)
@@ -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()"));
@@ -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"),
@@ -1201,7 +1206,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 &&
@@ -1621,7 +1627,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) {
index 71991e0..bc78fb2 100644 (file)
@@ -127,9 +127,12 @@ static void usage(void)
 
 static void dump_header(struct undo_header *hdr)
 {
-       printf("nr keys:\t%llu\n", ext2fs_le64_to_cpu(hdr->num_keys));
-       printf("super block:\t%llu\n", ext2fs_le64_to_cpu(hdr->super_offset));
-       printf("key block:\t%llu\n", ext2fs_le64_to_cpu(hdr->key_offset));
+       printf("nr keys:\t%llu\n",
+              (unsigned long long) ext2fs_le64_to_cpu(hdr->num_keys));
+       printf("super block:\t%llu\n",
+              (unsigned long long) ext2fs_le64_to_cpu(hdr->super_offset));
+       printf("key block:\t%llu\n",
+              (unsigned long long) ext2fs_le64_to_cpu(hdr->key_offset));
        printf("block size:\t%u\n", ext2fs_le32_to_cpu(hdr->block_size));
        printf("fs block size:\t%u\n", ext2fs_le32_to_cpu(hdr->fs_block_size));
        printf("super crc:\t0x%x\n", ext2fs_le32_to_cpu(hdr->sb_crc));
@@ -138,7 +141,8 @@ static void dump_header(struct undo_header *hdr)
        printf("incompat:\t0x%x\n", ext2fs_le32_to_cpu(hdr->f_incompat));
        printf("rocompat:\t0x%x\n", ext2fs_le32_to_cpu(hdr->f_rocompat));
        if (e2undo_has_feature_fs_offset(hdr))
-               printf("fs offset:\t%llu\n", ext2fs_le64_to_cpu(hdr->fs_offset));
+               printf("fs offset:\t%llu\n",
+                      (unsigned long long) ext2fs_le64_to_cpu(hdr->fs_offset));
        printf("header crc:\t0x%x\n", ext2fs_le32_to_cpu(hdr->header_crc));
 }
 
@@ -460,7 +464,7 @@ int main(int argc, char *argv[])
                if (!*opt_offset_string)
                        offset = ext2fs_le64_to_cpu(undo_ctx.hdr.fs_offset);
                retval = snprintf(opt_offset_string, sizeof(opt_offset_string),
-                                                 "offset=%llu", offset);
+                                 "offset=%llu", (unsigned long long) offset);
                if ((size_t) retval >= sizeof(opt_offset_string)) {
                        /* should not happen... */
                        com_err(prg_name, 0, _("specified offset is too large"));
@@ -517,7 +521,7 @@ int main(int argc, char *argv[])
                if (!force &&
                    ext2fs_le32_to_cpu(keyb->magic) != KEYBLOCK_MAGIC) {
                        fprintf(stderr, _("%s: wrong key magic at %llu\n"),
-                               tdb_file, lblk);
+                               tdb_file, (unsigned long long) lblk);
                        exit(1);
                }
                crc = keyb->crc;
@@ -527,7 +531,7 @@ int main(int argc, char *argv[])
                if (!force && ext2fs_le32_to_cpu(crc) != key_crc) {
                        fprintf(stderr,
                                _("%s: key block checksum error at %llu.\n"),
-                               tdb_file, lblk);
+                               tdb_file, (unsigned long long) lblk);
                        exit(1);
                }
 
@@ -550,7 +554,8 @@ int main(int argc, char *argv[])
                            ikey->size) {
                                com_err(prg_name, retval,
                                        _("%s: block %llu is too long."),
-                                       tdb_file, ikey->fsblk);
+                                       tdb_file,
+                                       (unsigned long long) ikey->fsblk);
                                exit(1);
                        }
 
@@ -562,7 +567,7 @@ int main(int argc, char *argv[])
                        if (retval) {
                                com_err(prg_name, retval,
                                        _("while fetching block %llu."),
-                                       ikey->fileblk);
+                                       (unsigned long long) ikey->fileblk);
                                if (!force)
                                        exit(1);
                                io_error = 1;
@@ -575,7 +580,8 @@ int main(int argc, char *argv[])
                                fprintf(stderr,
                                        _("checksum error in filesystem block "
                                          "%llu (undo blk %llu)\n"),
-                                       ikey->fsblk, ikey->fileblk);
+                                       (unsigned long long) ikey->fsblk,
+                                       (unsigned long long) ikey->fileblk);
                                if (!force)
                                        exit(1);
                                csum_error = 1;
@@ -598,21 +604,23 @@ int main(int argc, char *argv[])
                if (retval) {
                        com_err(prg_name, retval,
                                _("while fetching block %llu."),
-                               ikey->fileblk);
+                               (unsigned long long) ikey->fileblk);
                        io_error = 1;
                        continue;
                }
 
                if (verbose)
                        printf("Replayed block of size %u from %llu to %llu\n",
-                               ikey->size, ikey->fileblk, ikey->fsblk);
+                              ikey->size, (unsigned long long) ikey->fileblk,
+                              (unsigned long long) ikey->fsblk);
                if (dry_run)
                        continue;
                retval = io_channel_write_blk64(channel, ikey->fsblk,
                                                -(int)ikey->size, buf);
                if (retval) {
                        com_err(prg_name, retval,
-                               _("while writing block %llu."), ikey->fsblk);
+                               _("while writing block %llu."),
+                               (unsigned long long) ikey->fsblk);
                        io_error = 1;
                }
        }
index c6c6f13..b53d74e 100644 (file)
@@ -1179,10 +1179,13 @@ static int file_statistic(const char *file, const struct stat64 *buf,
                        do {
                                count++;
                                printf("[ext %d]:\tstart %llu:\tlogical "
-                                               "%llu:\tlen %llu\n", count,
-                                               ext_list_tmp->data.physical,
-                                               ext_list_tmp->data.logical,
-                                               ext_list_tmp->data.len);
+                                      "%llu:\tlen %llu\n", count,
+                                      (unsigned long long)
+                                      ext_list_tmp->data.physical,
+                                      (unsigned long long)
+                                      ext_list_tmp->data.logical,
+                                      (unsigned long long)
+                                      ext_list_tmp->data.len);
                                ext_list_tmp = ext_list_tmp->next;
                        } while (ext_list_tmp != logical_list_head);
 
@@ -1192,12 +1195,14 @@ static int file_statistic(const char *file, const struct stat64 *buf,
                        if (current_uid == ROOT_UID) {
                                if (strlen(file) > 40)
                                        printf("%s\n%50d/%-10d%6llu KB\n",
-                                               file, now_ext_count,
-                                               best_ext_count, size_per_ext);
+                                              file, now_ext_count,
+                                              best_ext_count,
+                                              (unsigned long long) size_per_ext);
                                else
                                        printf("%-40s%10d/%-10d%6llu KB\n",
-                                               file, now_ext_count,
-                                               best_ext_count, size_per_ext);
+                                              file, now_ext_count,
+                                              best_ext_count,
+                                              (unsigned long long) size_per_ext);
                        } else {
                                if (strlen(file) > 40)
                                        printf("%s\n%50d/%-10s%7s\n",
@@ -1220,14 +1225,16 @@ static int file_statistic(const char *file, const struct stat64 *buf,
                if (current_uid == ROOT_UID) {
                        if (strlen(msg_buffer) > 40)
                                printf("\033[79;0H\033[K%s\n"
-                                               "%50d/%-10d%6llu KB\n",
-                                               msg_buffer, now_ext_count,
-                                               best_ext_count, size_per_ext);
+                                      "%50d/%-10d%6llu KB\n",
+                                      msg_buffer, now_ext_count,
+                                      best_ext_count,
+                                      (unsigned long long) size_per_ext);
                        else
                                printf("\033[79;0H\033[K%-40s"
-                                               "%10d/%-10d%6llu KB\n",
-                                               msg_buffer, now_ext_count,
-                                               best_ext_count, size_per_ext);
+                                      "%10d/%-10d%6llu KB\n",
+                                      msg_buffer, now_ext_count,
+                                      best_ext_count,
+                                      (unsigned long long) size_per_ext);
                } else {
                        if (strlen(msg_buffer) > 40)
                                printf("\033[79;0H\033[K%s\n%50d/%-10s%7s\n",
@@ -1897,6 +1904,7 @@ int main(int argc, char *argv[])
                                                        frag_rank[j].msg_buffer,
                                                        frag_rank[j].now_count,
                                                        frag_rank[j].best_count,
+                                                       (unsigned long long)
                                                        frag_rank[j].
                                                                size_per_ext);
                                                } else if (strlen(frag_rank[j].
@@ -1907,6 +1915,7 @@ int main(int argc, char *argv[])
                                                        frag_rank[j].msg_buffer,
                                                        frag_rank[j].now_count,
                                                        frag_rank[j].best_count,
+                                                       (unsigned long long)
                                                        frag_rank[j].
                                                                size_per_ext);
                                                } else
@@ -1999,12 +2008,12 @@ int main(int argc, char *argv[])
                                                100 / files_block_count;
                                score = CALC_SCORE(files_ratio);
                                printf("\n Total/best extents\t\t\t\t%d/%d\n"
-                                       " Average size per extent"
-                                       "\t\t\t%llu KB\n"
-                                       " Fragmentation score\t\t\t\t%.0f\n",
-                                               extents_before_defrag,
-                                               extents_after_defrag,
-                                               size_per_ext, score);
+                                      " Average size per extent"
+                                      "\t\t\t%llu KB\n"
+                                      " Fragmentation score\t\t\t\t%.0f\n",
+                                      extents_before_defrag,
+                                      extents_after_defrag,
+                                      (unsigned long long) size_per_ext, score);
                                printf(" [0-30 no problem:"
                                        " 31-55 a little bit fragmented:"
                                        " 56- needs defrag]\n");
index 62d583b..1e43131 100644 (file)
@@ -374,9 +374,9 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents,
                        if (verbose && expected != 0) {
                                printf("Discontinuity: Block %llu is at %llu "
                                       "(was %llu)\n",
-                                       fm_ext.fe_logical / st->st_blksize,
-                                       fm_ext.fe_physical / st->st_blksize,
-                                       expected / st->st_blksize);
+                                      (unsigned long long) (fm_ext.fe_logical / st->st_blksize),
+                                      (unsigned long long) (fm_ext.fe_physical / st->st_blksize),
+                                      (unsigned long long) (expected / st->st_blksize));
                        }
                        /* create the new extent */
                        fm_last = fm_ext;
@@ -492,8 +492,8 @@ static int frag_report(const char *filename)
                __u32 state;
 
                printf("File size of %s is %llu (%llu block%s of %d bytes)",
-                      filename, (unsigned long long)st.st_size,
-                      numblocks * blksize >> blk_shift,
+                      filename, (unsigned long long) st.st_size,
+                      (unsigned long long) (numblocks * blksize >> blk_shift),
                       numblocks == 1 ? "" : "s", 1 << blk_shift);
                if (use_extent_cache &&
                    ioctl(fd, EXT4_IOC_GETSTATE, &state) == 0 &&
index 24acca8..0280b41 100644 (file)
@@ -337,7 +337,8 @@ static errcode_t mk_hugefile(ext2_filsys fs, blk64_t num,
                        if (retval)
                                com_err(program_name, retval,
                                        _("while zeroing block %llu "
-                                         "for hugefile"), ret_blk);
+                                         "for hugefile"),
+                                       (unsigned long long) ret_blk);
                }
 
                while (n) {
@@ -514,7 +515,7 @@ errcode_t mk_hugefiles(ext2_filsys fs, const char *device_name)
                        fprintf(stderr,
                                _("Partition offset of %llu (%uk) blocks "
                                  "not compatible with cluster size %u.\n"),
-                               part_offset, fs->blocksize,
+                               (unsigned long long) part_offset, fs->blocksize,
                                EXT2_CLUSTER_SIZE(fs->super));
                        exit(1);
                }
@@ -583,7 +584,8 @@ errcode_t mk_hugefiles(ext2_filsys fs, const char *device_name)
                        printf("%s", _("Huge files will be zero'ed\n"));
                printf(_("Creating %lu huge file(s) "), num_files);
                if (num_blocks)
-                       printf(_("with %llu blocks each"), num_blocks);
+                       printf(_("with %llu blocks each"),
+                              (unsigned long long) num_blocks);
                fputs(": ", stdout);
        }
        for (i=0; i < num_files; i++) {
index add441c..afbcf48 100644 (file)
@@ -257,7 +257,8 @@ static void test_disk(ext2_filsys fs, badblocks_list *bb_list)
 
        sprintf(buf, "badblocks -b %d -X %s%s%s %llu", fs->blocksize,
                quiet ? "" : "-s ", (cflag > 1) ? "-w " : "",
-               fs->device_name, ext2fs_blocks_count(fs->super)-1);
+               fs->device_name,
+               (unsigned long long) ext2fs_blocks_count(fs->super)-1);
        if (verbose)
                printf(_("Running command: %s\n"), buf);
        f = popen(buf, "r");
@@ -442,7 +443,8 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed)
                        if (retval) {
                                fprintf(stderr, _("\nCould not write %d "
                                          "blocks in inode table starting at %llu: %s\n"),
-                                       num, blk, error_message(retval));
+                                       num, (unsigned long long) blk,
+                                       error_message(retval));
                                exit(1);
                        }
                }
@@ -639,7 +641,7 @@ static void create_journal_dev(ext2_filsys fs)
                        com_err("create_journal_dev", retval,
                                _("while zeroing journal device "
                                  "(block %llu, count %d)"),
-                               err_blk, err_count);
+                               (unsigned long long) err_blk, err_count);
                        exit(1);
                }
                blk += c;
@@ -671,14 +673,15 @@ static void show_stats(ext2_filsys fs)
        if (!verbose) {
                printf(_("Creating filesystem with %llu %dk blocks and "
                         "%u inodes\n"),
-                      ext2fs_blocks_count(s), fs->blocksize >> 10,
-                      s->s_inodes_count);
+                      (unsigned long long) ext2fs_blocks_count(s),
+                      fs->blocksize >> 10, s->s_inodes_count);
                goto skip_details;
        }
 
        if (ext2fs_blocks_count(&fs_param) != ext2fs_blocks_count(s))
                fprintf(stderr, _("warning: %llu blocks unused.\n\n"),
-                      ext2fs_blocks_count(&fs_param) - ext2fs_blocks_count(s));
+                       (unsigned long long) (ext2fs_blocks_count(&fs_param) -
+                                             ext2fs_blocks_count(s)));
 
        printf(_("Filesystem label=%.*s\n"), EXT2_LEN_STR(s->s_volume_name));
 
@@ -698,9 +701,9 @@ static void show_stats(ext2_filsys fs)
        printf(_("Stride=%u blocks, Stripe width=%u blocks\n"),
               s->s_raid_stride, s->s_raid_stripe_width);
        printf(_("%u inodes, %llu blocks\n"), s->s_inodes_count,
-              ext2fs_blocks_count(s));
+              (unsigned long long) ext2fs_blocks_count(s));
        printf(_("%llu blocks (%2.2f%%) reserved for the super user\n"),
-               ext2fs_r_blocks_count(s),
+              (unsigned long long) ext2fs_r_blocks_count(s),
               100.0 *  ext2fs_r_blocks_count(s) / ext2fs_blocks_count(s));
        printf(_("First data block=%u\n"), s->s_first_data_block);
        if (root_uid != 0 || root_gid != 0)
@@ -744,7 +747,7 @@ skip_details:
                        col_left = 72;
                }
                col_left -= need;
-               printf("%llu", group_block);
+               printf("%llu", (unsigned long long) group_block);
        }
        printf("\n\n");
 }
@@ -2192,8 +2195,8 @@ profile_error:
                fprintf(stderr, _("%s: Size of device (0x%llx blocks) %s "
                                  "too big to be expressed\n\t"
                                  "in 32 bits using a blocksize of %d.\n"),
-                       program_name, fs_blocks_count, device_name,
-                       EXT2_BLOCK_SIZE(&fs_param));
+                       program_name, (unsigned long long) fs_blocks_count,
+                       device_name, EXT2_BLOCK_SIZE(&fs_param));
                exit(1);
        }
        /*
@@ -2206,8 +2209,8 @@ profile_error:
                fprintf(stderr, _("%s: Size of device (0x%llx blocks) %s "
                                  "too big to create\n\t"
                                  "a filesystem using a blocksize of %d.\n"),
-                       program_name, fs_blocks_count, device_name,
-                       EXT2_BLOCK_SIZE(&fs_param));
+                       program_name, (unsigned long long) fs_blocks_count,
+                       device_name, EXT2_BLOCK_SIZE(&fs_param));
                exit(1);
        }
 
@@ -2602,14 +2605,15 @@ profile_error:
                        else {
                                com_err(program_name, 0,
                                        _("too many inodes (%llu), raise "
-                                         "inode ratio?"), n);
+                                         "inode ratio?"),
+                                       (unsigned long long) n);
                                exit(1);
                        }
                }
        } else if (num_inodes > MAX_32_NUM) {
                com_err(program_name, 0,
                        _("too many inodes (%llu), specify < 2^32 inodes"),
-                         num_inodes);
+                       (unsigned long long) num_inodes);
                exit(1);
        }
        /*
@@ -3054,7 +3058,7 @@ int main (int argc, char *argv[])
                32768 : fs->blocksize * 8);
        io_channel_set_options(fs->io, opt_string);
        if (offset) {
-               sprintf(opt_string, "offset=%llu", offset);
+               sprintf(opt_string, "offset=%llu", (unsigned long long) offset);
                io_channel_set_options(fs->io, opt_string);
        }
 
@@ -3330,7 +3334,7 @@ int main (int argc, char *argv[])
                if (retval) {
                        com_err(program_name, retval,
                                _("while zeroing block %llu at end of filesystem"),
-                               ret_blk);
+                               (unsigned long long) ret_blk);
                }
                write_inode_tables(fs, lazy_itable_init, itable_zeroed);
                create_root_dir(fs);
index 40f5173..11715ba 100644 (file)
@@ -3142,20 +3142,21 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
                                          ext2fs_blocks_count(sb) / 100.0);
                ext2fs_mark_super_dirty(fs);
                printf (_("Setting reserved blocks percentage to %g%% (%llu blocks)\n"),
-                       reserved_ratio, ext2fs_r_blocks_count(sb));
+                       reserved_ratio,
+                       (unsigned long long) ext2fs_r_blocks_count(sb));
        }
        if (r_flag) {
                if (reserved_blocks > ext2fs_blocks_count(sb)/2) {
                        com_err(program_name, 0,
                                _("reserved blocks count is too big (%llu)"),
-                               reserved_blocks);
+                               (unsigned long long) reserved_blocks);
                        rc = 1;
                        goto closefs;
                }
                ext2fs_r_blocks_count_set(sb, reserved_blocks);
                ext2fs_mark_super_dirty(fs);
                printf(_("Setting reserved blocks count to %llu\n"),
-                      reserved_blocks);
+                      (unsigned long long) reserved_blocks);
        }
        if (s_flag == 1) {
                if (ext2fs_has_feature_sparse_super(sb)) {
index e5ca16c..4177c6f 100644 (file)
@@ -201,10 +201,15 @@ void ext2fs_extent_dump(ext2_extent extent, FILE *out)
 
        fputs(_("# Extent dump:\n"), out);
        fprintf(out, _("#\tNum=%llu, Size=%llu, Cursor=%llu, Sorted=%llu\n"),
-              extent->num, extent->size, extent->cursor, extent->sorted);
+              (unsigned long long) extent->num,
+               (unsigned long long) extent->size,
+               (unsigned long long) extent->cursor,
+               (unsigned long long) extent->sorted);
        for (i=0, ent=extent->list; i < extent->num; i++, ent++) {
-               fprintf(out, "#\t\t %llu -> %llu (%llu)\n", ent->old_loc,
-                       ent->new_loc, ent->size);
+               fprintf(out, "#\t\t %llu -> %llu (%llu)\n",
+                       (unsigned long long) ent->old_loc,
+                       (unsigned long long) ent->new_loc,
+                       (unsigned long long) ent->size);
        }
 }
 
index dce03f9..ccfd289 100644 (file)
@@ -470,7 +470,7 @@ int main (int argc, char ** argv)
 
        if (print_min_size) {
                printf(_("Estimated minimum size of the filesystem: %llu\n"),
-                      min_size);
+                      (unsigned long long) min_size);
                exit(0);
        }
 
@@ -545,7 +545,8 @@ int main (int argc, char ** argv)
 
        if (!force && new_size < min_size) {
                com_err(program_name, 0,
-                       _("New size smaller than minimum (%llu)\n"), min_size);
+                       _("New size smaller than minimum (%llu)\n"),
+                       (unsigned long long) min_size);
                exit(1);
        }
        if (use_stride >= 0) {
@@ -577,8 +578,8 @@ int main (int argc, char ** argv)
        if (!force && (new_size > max_size)) {
                fprintf(stderr, _("The containing partition (or device)"
                        " is only %llu (%dk) blocks.\nYou requested a new size"
-                       " of %llu blocks.\n\n"), max_size,
-                       blocksize / 1024, new_size);
+                       " of %llu blocks.\n\n"), (unsigned long long) max_size,
+                       blocksize / 1024, (unsigned long long) new_size);
                exit(1);
        }
        if ((flags & RESIZE_DISABLE_64BIT) && (flags & RESIZE_ENABLE_64BIT)) {
@@ -605,7 +606,8 @@ int main (int argc, char ** argv)
                }
        } else if (new_size == ext2fs_blocks_count(fs->super)) {
                fprintf(stderr, _("The filesystem is already %llu (%dk) "
-                       "blocks long.  Nothing to do!\n\n"), new_size,
+                       "blocks long.  Nothing to do!\n\n"),
+                       (unsigned long long) new_size,
                        blocksize / 1024);
                exit(0);
        }
@@ -636,7 +638,8 @@ int main (int argc, char ** argv)
                else
                        printf(_("Resizing the filesystem on "
                                 "%s to %llu (%dk) blocks.\n"),
-                              device_name, new_size, blocksize / 1024);
+                              device_name, (unsigned long long) new_size,
+                              blocksize / 1024);
                retval = resize_fs(fs, &new_size, flags,
                                   ((flags & RESIZE_PERCENT_COMPLETE) ?
                                    resize_progress_func : 0));
@@ -653,7 +656,7 @@ int main (int argc, char ** argv)
                exit(1);
        }
        printf(_("The filesystem on %s is now %llu (%dk) blocks long.\n\n"),
-              device_name, new_size, blocksize / 1024);
+              device_name, (unsigned long long) new_size, blocksize / 1024);
 
        if ((st_buf.st_size > new_file_size) &&
            (fd > 0)) {
index 2caf946..eef7c0b 100644 (file)
@@ -218,7 +218,8 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
        }
 
        printf(_("Performing an on-line resize of %s to %llu (%dk) blocks.\n"),
-              fs->device_name, *new_size, fs->blocksize / 1024);
+              fs->device_name, (unsigned long long) *new_size,
+              fs->blocksize / 1024);
 
        size = fs->group_desc_count * sb->s_blocks_per_group +
                sb->s_first_data_block;
index 270e4de..5d2a856 100644 (file)
@@ -177,9 +177,9 @@ errcode_t resize_fs(ext2_filsys fs, blk64_t *new_size, int flags,
 #ifdef RESIZE2FS_DEBUG
        if (rfs->flags & RESIZE_DEBUG_BMOVE)
                printf("Number of free blocks: %llu/%llu, Needed: %llu\n",
-                      ext2fs_free_blocks_count(rfs->old_fs->super),
-                      ext2fs_free_blocks_count(rfs->new_fs->super),
-                      rfs->needed_blocks);
+                      (unsigned long long) ext2fs_free_blocks_count(rfs->old_fs->super),
+                      (unsigned long long) ext2fs_free_blocks_count(rfs->new_fs->super),
+                      (unsigned long long) rfs->needed_blocks);
 #endif
 
        init_resource_track(&rtrack, "block_mover", fs->io);
@@ -758,7 +758,7 @@ retry:
        new_inodes =(unsigned long long) fs->super->s_inodes_per_group * fs->group_desc_count;
        if (new_inodes > ~0U) {
                fprintf(stderr, _("inodes (%llu) must be less than %u\n"),
-                                  new_inodes, ~0U);
+                       (unsigned long long) new_inodes, ~0U);
                return EXT2_ET_TOO_MANY_INODES;
        }
        fs->super->s_inodes_count = fs->super->s_inodes_per_group *
@@ -1644,7 +1644,8 @@ static errcode_t resize2fs_get_alloc_block(ext2_filsys fs,
 
 #ifdef RESIZE2FS_DEBUG
        if (rfs->flags & 0xF)
-               printf("get_alloc_block allocating %llu\n", blk);
+               printf("get_alloc_block allocating %llu\n",
+                      (unsigned long long) blk);
 #endif
 
        ext2fs_mark_block_bitmap2(rfs->old_fs->block_map, blk);
@@ -1750,7 +1751,9 @@ static errcode_t block_mover(ext2_resize_t rfs)
 #ifdef RESIZE2FS_DEBUG
                if (rfs->flags & RESIZE_DEBUG_BMOVE)
                        printf("Moving %llu blocks %llu->%llu\n",
-                              size, old_blk, new_blk);
+                              (unsigned long long) size,
+                              (unsigned long long) old_blk,
+                              (unsigned long long) new_blk);
 #endif
                do {
                        c = size;
@@ -1843,8 +1846,9 @@ static int process_block(ext2_filsys fs, blk64_t  *block_nr,
 #ifdef RESIZE2FS_DEBUG
                        if (pb->rfs->flags & RESIZE_DEBUG_BMOVE)
                                printf("ino=%u, blockcnt=%lld, %llu->%llu\n",
-                                      pb->old_ino, blockcnt, block,
-                                      new_block);
+                                      pb->old_ino, (long long) blockcnt,
+                                      (unsigned long long) block,
+                                      (unsigned long long) new_block);
 #endif
                        block = new_block;
                }
@@ -2460,7 +2464,8 @@ static errcode_t move_itables(ext2_resize_t rfs)
 #ifdef RESIZE2FS_DEBUG
                if (rfs->flags & RESIZE_DEBUG_ITABLEMOVE)
                        printf("Itable move group %d block %llu->%llu (diff %lld)\n",
-                              i, old_blk, new_blk, diff);
+                              i, (unsigned long long) old_blk,
+                              (unsigned long long) new_blk, diff);
 #endif
 
                if (!diff)
@@ -2934,7 +2939,8 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
        }
 #ifdef RESIZE2FS_DEBUG
        if (flags & RESIZE_DEBUG_MIN_CALC)
-               printf("fs requires %llu data blocks.\n", data_needed);
+               printf("fs requires %llu data blocks.\n",
+                      (unsigned long long) data_needed);
 #endif
 
        /*
@@ -2977,7 +2983,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
 #ifdef RESIZE2FS_DEBUG
        if (flags & RESIZE_DEBUG_MIN_CALC)
                printf("With %d group(s), we have %llu blocks available.\n",
-                      groups, data_blocks);
+                      groups, (unsigned long long) data_blocks);
 #endif
 
        /*
@@ -3030,8 +3036,10 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
                if (flags & RESIZE_DEBUG_MIN_CALC)
                        printf("Added %d extra group(s), "
                               "blks_needed %llu, data_blocks %llu, "
-                              "last_start %llu\n", extra_grps, blks_needed,
-                              data_blocks, last_start);
+                              "last_start %llu\n", extra_grps,
+                              (unsigned long long) blks_needed,
+                              (unsigned long long) data_blocks,
+                              (unsigned long long) last_start);
 #endif
        }
 
@@ -3046,7 +3054,8 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
 
 #ifdef RESIZE2FS_DEBUG
        if (flags & RESIZE_DEBUG_MIN_CALC)
-               printf("Last group's overhead is %llu\n", overhead);
+               printf("Last group's overhead is %llu\n",
+                      (unsigned long long) overhead);
 #endif
 
        /*
@@ -3059,7 +3068,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
 #ifdef RESIZE2FS_DEBUG
                if (flags & RESIZE_DEBUG_MIN_CALC)
                        printf("Need %llu data blocks in last group\n",
-                              remainder);
+                              (unsigned long long) remainder);
 #endif
                /*
                 * 50 is a magic number that mkfs/resize uses to see if its
@@ -3077,7 +3086,8 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
        overhead += fs->super->s_first_data_block;
 #ifdef RESIZE2FS_DEBUG
        if (flags & RESIZE_DEBUG_MIN_CALC)
-               printf("Final size of last group is %lld\n", overhead);
+               printf("Final size of last group is %llu\n",
+                      (unsigned long long) overhead);
 #endif
 
        /* Add extra slack for bigalloc file systems */
@@ -3104,7 +3114,8 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
 
 #ifdef RESIZE2FS_DEBUG
        if (flags & RESIZE_DEBUG_MIN_CALC)
-               printf("Estimated blocks needed: %llu\n", blks_needed);
+               printf("Estimated blocks needed: %llu\n",
+                      (unsigned long long) blks_needed);
 #endif
 
        /*
@@ -3139,7 +3150,8 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
 
 #ifdef RESIZE2FS_DEBUG
                if (flags & RESIZE_DEBUG_MIN_CALC)
-                       printf("Extents safety margin: %llu\n", safe_margin);
+                       printf("Extents safety margin: %llu\n",
+                              (unsigned long long) safe_margin);
 #endif
                blks_needed += safe_margin;
        }
index 5e9aed7..11ad132 100644 (file)
@@ -88,7 +88,8 @@ void do_test(FILE *in, FILE *out)
                                goto handle_error;
                } else if (!strcmp(cmd, "lookup")) {
                        num2 = ext2fs_extent_translate(extent, num1);
-                       fprintf(out, "# Answer: %llu%s\n", num2,
+                       fprintf(out, "# Answer: %llu%s\n",
+                               (unsigned long long) num2,
                                num2 ? "" : " (not found)");
                } else if (!strcmp(cmd, "dump")) {
                        ext2fs_extent_dump(extent, out);
@@ -104,7 +105,9 @@ void do_test(FILE *in, FILE *out)
                                if (!size)
                                        break;
                                fprintf(out, "# %llu -> %llu (%llu)\n",
-                                       num1, num2, size);
+                                       (unsigned long long) num1,
+                                       (unsigned long long) num2,
+                                       (unsigned long long) size);
                        }
                } else
                        fputs("# Syntax error\n", out);