* [PATCH 01/10] e2fsck: use problem_t to suppress some -Wconversion warnings
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 02/10] e2fsck: use errcode_t " Theodore Ts'o
` (8 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
All code which stores a problem code should use the problem_t type.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/pass1.c | 8 ++++----
e2fsck/pass2.c | 12 ++++++------
e2fsck/pass5.c | 8 +++++---
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 311706e..3cf4aac 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -276,7 +276,7 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
struct ext2_ext_attr_entry *entry;
char *start;
unsigned int storage_size, remain;
- int problem = 0;
+ problem_t problem = 0;
inode = (struct ext2_inode_large *) pctx->inode;
storage_size = EXT2_INODE_SIZE(ctx->fs->super) - EXT2_GOOD_OLD_INODE_SIZE -
@@ -950,7 +950,7 @@ void e2fsck_pass1(e2fsck_t ctx)
inode_size, "pass1");
}
} else if (ino < EXT2_FIRST_INODE(fs->super)) {
- int problem = 0;
+ problem_t problem = 0;
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
if (ino == EXT2_BOOT_LOADER_INO) {
@@ -1769,7 +1769,7 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
e2_blkcnt_t blockcnt;
unsigned int i;
int is_dir, is_leaf;
- errcode_t problem;
+ problem_t problem;
struct ext2_extent_info info;
pctx->errcode = ext2fs_extent_get_info(ehandle, &info);
@@ -2255,7 +2255,7 @@ static int process_block(ext2_filsys fs,
struct problem_context *pctx;
blk64_t blk = *block_nr;
int ret_code = 0;
- int problem = 0;
+ problem_t problem = 0;
e2fsck_t ctx;
p = (struct process_block_struct *) priv_data;
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index f2ac2dd..6ef17d3 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -351,9 +351,9 @@ static int check_dot(e2fsck_t ctx,
{
struct ext2_dir_entry *nextdir;
unsigned int rec_len, new_len;
- int status = 0;
- int created = 0;
- int problem = 0;
+ int status = 0;
+ int created = 0;
+ problem_t problem = 0;
if (!dirent->inode)
problem = PR_2_MISSING_DOT;
@@ -410,7 +410,7 @@ static int check_dotdot(e2fsck_t ctx,
struct ext2_dir_entry *dirent,
ext2_ino_t ino, struct problem_context *pctx)
{
- int problem = 0;
+ problem_t problem = 0;
unsigned int rec_len;
if (!dirent->inode)
@@ -727,7 +727,7 @@ static int check_dir_block(ext2_filsys fs,
struct check_dir_struct *cd;
char *buf;
e2fsck_t ctx;
- int problem;
+ problem_t problem;
struct ext2_dx_root_info *root;
struct ext2_dx_countlimit *limit;
static dict_t de_dict;
@@ -1268,7 +1268,7 @@ extern int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
int not_fixed = 0;
unsigned char *frag, *fsize;
struct problem_context pctx;
- int problem = 0;
+ problem_t problem = 0;
e2fsck_read_inode(ctx, ino, &inode, "process_bad_inode");
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index fce0f6e..feaa83e 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -151,7 +151,7 @@ static void e2fsck_discard_inodes(e2fsck_t ctx, dgrp_t group,
#define NO_BLK ((blk64_t) -1)
-static void print_bitmap_problem(e2fsck_t ctx, int problem,
+static void print_bitmap_problem(e2fsck_t ctx, problem_t problem,
struct problem_context *pctx)
{
switch (problem) {
@@ -203,7 +203,8 @@ static void check_block_bitmaps(e2fsck_t ctx)
unsigned int group_free = 0;
int actual, bitmap;
struct problem_context pctx;
- int problem, save_problem, fixit, had_problem;
+ problem_t problem, save_problem;
+ int fixit, had_problem;
errcode_t retval;
int csum_flag;
int skip_group = 0;
@@ -542,7 +543,8 @@ static void check_inode_bitmaps(e2fsck_t ctx)
int actual, bitmap;
errcode_t retval;
struct problem_context pctx;
- int problem, save_problem, fixit, had_problem;
+ problem_t problem, save_problem;
+ int fixit, had_problem;
int csum_flag;
int skip_group = 0;
int redo_flag = 0;
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/10] e2fsck: use errcode_t to suppress some -Wconversion warnings
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
2013-12-03 5:10 ` [PATCH 01/10] e2fsck: use problem_t to suppress some -Wconversion warnings Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 03/10] e2fsck: use blk_t instead of blk64_t in check_resize_inode() Theodore Ts'o
` (7 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
We need to store some error codes using an int to keep recovery.c as
close as possible to the recovery.c source file in the kernel.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/e2fsck.h | 4 ++--
e2fsck/journal.c | 20 ++++++++++----------
e2fsck/pass1b.c | 8 ++++----
e2fsck/rehash.c | 2 +-
e2fsck/unix.c | 2 +-
e2fsck/util.c | 8 ++++----
6 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index e3ad78d..3c4f832 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -452,8 +452,8 @@ extern const char *ehandler_operation(const char *op);
extern void ehandler_init(io_channel channel);
/* journal.c */
-extern int e2fsck_check_ext3_journal(e2fsck_t ctx);
-extern int e2fsck_run_ext3_journal(e2fsck_t ctx);
+extern errcode_t e2fsck_check_ext3_journal(e2fsck_t ctx);
+extern errcode_t e2fsck_run_ext3_journal(e2fsck_t ctx);
extern void e2fsck_move_ext3_journal(e2fsck_t ctx);
extern int e2fsck_fix_ext3_journal_hint(e2fsck_t ctx);
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 0cbdb7b..ff11f22 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -62,7 +62,7 @@ int journal_bmap(journal_t *journal, blk64_t block, unsigned long long *phys)
retval= ext2fs_bmap2(inode->i_ctx->fs, inode->i_ino,
&inode->i_ext2, NULL, 0, block, 0, &pblk);
*phys = pblk;
- return (retval);
+ return (int) retval;
#endif
}
@@ -108,7 +108,7 @@ void sync_blockdev(kdev_t kdev)
void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
{
- int retval;
+ errcode_t retval;
struct buffer_head *bh;
for (; nr > 0; --nr) {
@@ -123,7 +123,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
com_err(bh->b_ctx->device_name, retval,
"while reading block %llu\n",
bh->b_blocknr);
- bh->b_err = retval;
+ bh->b_err = (int) retval;
continue;
}
bh->b_uptodate = 1;
@@ -138,7 +138,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
com_err(bh->b_ctx->device_name, retval,
"while writing block %llu\n",
bh->b_blocknr);
- bh->b_err = retval;
+ bh->b_err = (int) retval;
continue;
}
bh->b_dirty = 0;
@@ -340,7 +340,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
#else
journal->j_inode = j_inode;
ctx->journal_io = ctx->fs->io;
- if ((retval = journal_bmap(journal, 0, &start)) != 0)
+ if ((retval = (errcode_t) journal_bmap(journal, 0, &start)) != 0)
goto errout;
#endif
} else {
@@ -705,7 +705,7 @@ static void e2fsck_journal_release(e2fsck_t ctx, journal_t *journal,
* This function makes sure that the superblock fields regarding the
* journal are consistent.
*/
-int e2fsck_check_ext3_journal(e2fsck_t ctx)
+errcode_t e2fsck_check_ext3_journal(e2fsck_t ctx)
{
struct ext2_super_block *sb = ctx->fs->super;
journal_t *journal;
@@ -714,7 +714,7 @@ int e2fsck_check_ext3_journal(e2fsck_t ctx)
struct problem_context pctx;
problem_t problem;
int reset = 0, force_fsck = 0;
- int retval;
+ errcode_t retval;
/* If we don't have any journal features, don't do anything more */
if (!(sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
@@ -838,7 +838,7 @@ static errcode_t recover_ext3_journal(e2fsck_t ctx)
{
struct problem_context pctx;
journal_t *journal;
- int retval;
+ errcode_t retval;
clear_problem_context(&pctx);
@@ -873,7 +873,7 @@ errout:
return retval;
}
-int e2fsck_run_ext3_journal(e2fsck_t ctx)
+errcode_t e2fsck_run_ext3_journal(e2fsck_t ctx)
{
io_manager io_ptr = ctx->fs->io->manager;
int blocksize = ctx->fs->blocksize;
@@ -920,7 +920,7 @@ int e2fsck_run_ext3_journal(e2fsck_t ctx)
ctx->fs->super->s_kbytes_written += kbytes_written;
/* Set the superblock flags */
- e2fsck_clear_recover(ctx, recover_retval);
+ e2fsck_clear_recover(ctx, recover_retval != 0);
/*
* Do one last sanity check, and propagate journal->s_errno to
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index cd6c883..a3b880c 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -88,8 +88,8 @@ static int process_pass1b_block(ext2_filsys fs, blk64_t *blocknr,
int ref_offset, void *priv_data);
static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
struct dup_inode *dp, char *block_buf);
-static int clone_file(e2fsck_t ctx, ext2_ino_t ino,
- struct dup_inode *dp, char* block_buf);
+static errcode_t clone_file(e2fsck_t ctx, ext2_ino_t ino,
+ struct dup_inode *dp, char* block_buf);
static int check_if_fs_block(e2fsck_t ctx, blk64_t test_block);
static int check_if_fs_cluster(e2fsck_t ctx, blk64_t cluster);
@@ -779,8 +779,8 @@ static int clone_file_block(ext2_filsys fs,
return 0;
}
-static int clone_file(e2fsck_t ctx, ext2_ino_t ino,
- struct dup_inode *dp, char* block_buf)
+static errcode_t clone_file(e2fsck_t ctx, ext2_ino_t ino,
+ struct dup_inode *dp, char* block_buf)
{
ext2_filsys fs = ctx->fs;
errcode_t retval;
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index 9dbdb3b..ac0ff31 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -55,7 +55,7 @@
struct fill_dir_struct {
char *buf;
struct ext2_inode *inode;
- int err;
+ errcode_t err;
e2fsck_t ctx;
struct hash_entry *harray;
int max_array, num_array;
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 1ed8fc5..bacb86a 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1071,7 +1071,7 @@ static errcode_t try_open_fs(e2fsck_t ctx, int flags, io_manager io_ptr,
static const char *my_ver_string = E2FSPROGS_VERSION;
static const char *my_ver_date = E2FSPROGS_DATE;
-static int e2fsck_check_mmp(ext2_filsys fs, e2fsck_t ctx)
+static errcode_t e2fsck_check_mmp(ext2_filsys fs, e2fsck_t ctx)
{
struct mmp_struct *mmp_s;
unsigned int mmp_check_interval;
diff --git a/e2fsck/util.c b/e2fsck/util.c
index d361a51..c9e2ca1 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -439,7 +439,7 @@ void print_resource_track(e2fsck_t ctx, const char *desc,
void e2fsck_read_inode(e2fsck_t ctx, unsigned long ino,
struct ext2_inode * inode, const char *proc)
{
- int retval;
+ errcode_t retval;
retval = ext2fs_read_inode(ctx->fs, ino, inode);
if (retval) {
@@ -453,7 +453,7 @@ void e2fsck_read_inode_full(e2fsck_t ctx, unsigned long ino,
struct ext2_inode *inode, int bufsize,
const char *proc)
{
- int retval;
+ errcode_t retval;
retval = ext2fs_read_inode_full(ctx->fs, ino, inode, bufsize);
if (retval) {
@@ -467,7 +467,7 @@ extern void e2fsck_write_inode_full(e2fsck_t ctx, unsigned long ino,
struct ext2_inode * inode, int bufsize,
const char *proc)
{
- int retval;
+ errcode_t retval;
retval = ext2fs_write_inode_full(ctx->fs, ino, inode, bufsize);
if (retval) {
@@ -480,7 +480,7 @@ extern void e2fsck_write_inode_full(e2fsck_t ctx, unsigned long ino,
extern void e2fsck_write_inode(e2fsck_t ctx, unsigned long ino,
struct ext2_inode * inode, const char *proc)
{
- int retval;
+ errcode_t retval;
retval = ext2fs_write_inode(ctx->fs, ino, inode);
if (retval) {
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/10] e2fsck: use blk_t instead of blk64_t in check_resize_inode()
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
2013-12-03 5:10 ` [PATCH 01/10] e2fsck: use problem_t to suppress some -Wconversion warnings Theodore Ts'o
2013-12-03 5:10 ` [PATCH 02/10] e2fsck: use errcode_t " Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 04/10] dumpe2fs: fix printing of block offsets for 64-bit file systems Theodore Ts'o
` (6 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
The resize inode only works on 32-bit block numbers, so use blk_t
instead of blk64_t. This avoids some -Wconversion noise, and slims
the compiled code slightly, especially on 32-bit platforms.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 352f16d..ce824f4 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -317,7 +317,7 @@ void check_resize_inode(e2fsck_t ctx)
struct problem_context pctx;
int i, gdt_off, ind_off;
dgrp_t j;
- blk64_t blk, pblk;
+ blk_t blk, pblk;
blk_t expect; /* for resize inode, which is 32-bit only */
__u32 *dind_buf = 0, *ind_buf;
errcode_t retval;
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/10] dumpe2fs: fix printing of block offsets for 64-bit file systems
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
` (2 preceding siblings ...)
2013-12-03 5:10 ` [PATCH 03/10] e2fsck: use blk_t instead of blk64_t in check_resize_inode() Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h Theodore Ts'o
` (5 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
Use ext2fs_group_first_block2() instead of ext2fs_group_first_block()
to avoid dumpe2fs from printing crazy block offsets when we have block
numbers which are larger than 32 bits.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
misc/dumpe2fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 2ba1771..2464100 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -146,7 +146,7 @@ static void print_bg_rel_offset(ext2_filsys fs, blk64_t block, int itable,
EXT4_FEATURE_INCOMPAT_FLEX_BG) {
dgrp_t flex_grp = ext2fs_group_of_blk2(fs, block);
printf(" (bg #%u + %u)", flex_grp,
- (unsigned)(block-ext2fs_group_first_block(fs,flex_grp)));
+ (unsigned)(block-ext2fs_group_first_block2(fs,flex_grp)));
}
}
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
` (3 preceding siblings ...)
2013-12-03 5:10 ` [PATCH 04/10] dumpe2fs: fix printing of block offsets for 64-bit file systems Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 19:16 ` Darrick J. Wong
2013-12-03 5:10 ` [PATCH 06/10] libext2fs: add explicit casts to bitops.h Theodore Ts'o
` (4 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
Add some explicit casts to silence some -Wconversion noise.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/ext2fs.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index b7a784e..eb1901e 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -1673,14 +1673,14 @@ _INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
/*
* Return the group # of a block
*/
-_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
+_INLINE_ dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
{
return ext2fs_group_of_blk2(fs, blk);
}
/*
* Return the group # of an inode number
*/
-_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
+_INLINE_ dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
{
return (ino - 1) / fs->super->s_inodes_per_group;
}
@@ -1690,7 +1690,7 @@ _INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
*/
_INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
{
- return ext2fs_group_first_block2(fs, group);
+ return (blk_t) ext2fs_group_first_block2(fs, group);
}
/*
@@ -1698,13 +1698,13 @@ _INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
*/
_INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group)
{
- return ext2fs_group_last_block2(fs, group);
+ return (blk_t) ext2fs_group_last_block2(fs, group);
}
_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
struct ext2_inode *inode)
{
- return ext2fs_inode_data_blocks2(fs, inode);
+ return (blk_t) ext2fs_inode_data_blocks2(fs, inode);
}
/*
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h
2013-12-03 5:10 ` [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h Theodore Ts'o
@ 2013-12-03 19:16 ` Darrick J. Wong
2013-12-03 19:52 ` Theodore Ts'o
0 siblings, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2013-12-03 19:16 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List, Kit Westneat
On Tue, Dec 03, 2013 at 12:10:13AM -0500, Theodore Ts'o wrote:
> Add some explicit casts to silence some -Wconversion noise.
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
> lib/ext2fs/ext2fs.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
> index b7a784e..eb1901e 100644
> --- a/lib/ext2fs/ext2fs.h
> +++ b/lib/ext2fs/ext2fs.h
> @@ -1673,14 +1673,14 @@ _INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
> /*
> * Return the group # of a block
> */
> -_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
> +_INLINE_ dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
The function prototypes up around line 1604 need to be updated:
In file included from inline.c:38:0:
ext2fs.h:1810:17: error: conflicting types for ‘ext2fs_group_of_blk’
ext2fs.h:1604:12: note: previous declaration of ‘ext2fs_group_of_blk’ was here
ext2fs.h:1817:17: error: conflicting types for ‘ext2fs_group_of_ino’
ext2fs.h:1605:12: note: previous declaration of ‘ext2fs_group_of_ino’ was here
--D
---
libext2fs: fix function declarations to match definition
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
lib/ext2fs/ext2fs.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index f9b795a..898ad0c 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -1601,8 +1601,8 @@ extern void ext2fs_mark_ib_dirty(ext2_filsys fs);
extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
extern int ext2fs_test_ib_dirty(ext2_filsys fs);
extern int ext2fs_test_bb_dirty(ext2_filsys fs);
-extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
-extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
+extern dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
+extern dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group);
extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group);
extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h
2013-12-03 19:16 ` Darrick J. Wong
@ 2013-12-03 19:52 ` Theodore Ts'o
2013-12-03 20:13 ` Darrick J. Wong
0 siblings, 1 reply; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 19:52 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Ext4 Developers List, Kit Westneat
On Tue, Dec 03, 2013 at 11:16:08AM -0800, Darrick J. Wong wrote:
>
> The function prototypes up around line 1604 need to be updated:
>
> In file included from inline.c:38:0:
> ext2fs.h:1810:17: error: conflicting types for ‘ext2fs_group_of_blk’
> ext2fs.h:1604:12: note: previous declaration of ‘ext2fs_group_of_blk’ was here
> ext2fs.h:1817:17: error: conflicting types for ‘ext2fs_group_of_ino’
> ext2fs.h:1605:12: note: previous declaration of ‘ext2fs_group_of_ino’ was here
Nice catch; I didn't get these errors on my build for some reason.
I've applied your fix, thanks.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h
2013-12-03 19:52 ` Theodore Ts'o
@ 2013-12-03 20:13 ` Darrick J. Wong
0 siblings, 0 replies; 17+ messages in thread
From: Darrick J. Wong @ 2013-12-03 20:13 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List, Kit Westneat
On Tue, Dec 03, 2013 at 02:52:38PM -0500, Theodore Ts'o wrote:
> On Tue, Dec 03, 2013 at 11:16:08AM -0800, Darrick J. Wong wrote:
> >
> > The function prototypes up around line 1604 need to be updated:
> >
> > In file included from inline.c:38:0:
> > ext2fs.h:1810:17: error: conflicting types for ‘ext2fs_group_of_blk’
> > ext2fs.h:1604:12: note: previous declaration of ‘ext2fs_group_of_blk’ was here
> > ext2fs.h:1817:17: error: conflicting types for ‘ext2fs_group_of_ino’
> > ext2fs.h:1605:12: note: previous declaration of ‘ext2fs_group_of_ino’ was here
>
> Nice catch; I didn't get these errors on my build for some reason.
I think it's because at some point I edited one of my debug patches to #define
NO_INLINE_FUNCS unconditionally so that I'd get bonked by things like that.
--D
>
> I've applied your fix, thanks.
>
> - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 06/10] libext2fs: add explicit casts to bitops.h
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
` (4 preceding siblings ...)
2013-12-03 5:10 ` [PATCH 05/10] libext2fs: add explicit casts to ext2fs.h Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 07/10] e2fsck: fix j_maxlen if the file system is exactly 1 << 32 blocks Theodore Ts'o
` (3 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
Add some explicit casts to silence some -Wconversion noise.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/bitops.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h
index edf82f2..3e8132d 100644
--- a/lib/ext2fs/bitops.h
+++ b/lib/ext2fs/bitops.h
@@ -244,7 +244,7 @@ _INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr)
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
- *ADDR |= (1 << (nr & 0x07));
+ *ADDR |= (unsigned char) (1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
@@ -252,7 +252,7 @@ _INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
- *ADDR &= ~(1 << (nr & 0x07));
+ *ADDR &= (unsigned char) ~(1 << (nr & 0x07));
}
@@ -261,7 +261,7 @@ _INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr)
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
- *ADDR |= (1 << (nr & 0x07));
+ *ADDR |= (unsigned char) (1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
@@ -269,7 +269,7 @@ _INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
- *ADDR &= ~(1 << (nr & 0x07));
+ *ADDR &= (unsigned char) ~(1 << (nr & 0x07));
}
@@ -358,7 +358,7 @@ _INLINE_ __u16 ext2fs_swab16(__u16 val)
_INLINE_ __u16 ext2fs_swab16(__u16 val)
{
- return (val >> 8) | (val << 8);
+ return (val >> 8) | (__u16) (val << 8);
}
_INLINE_ __u32 ext2fs_swab32(__u32 val)
@@ -371,7 +371,7 @@ _INLINE_ __u32 ext2fs_swab32(__u32 val)
_INLINE_ __u64 ext2fs_swab64(__u64 val)
{
- return (ext2fs_swab32(val >> 32) |
+ return (ext2fs_swab32((__u32) (val >> 32)) |
(((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
}
@@ -600,7 +600,7 @@ _INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitm
rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
- *out = o;
+ *out = (ext2_ino_t) o;
return rv;
}
@@ -611,7 +611,7 @@ _INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap)
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap)
{
- return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
+ return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap)
@@ -621,7 +621,7 @@ _INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap)
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap)
{
- return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
+ return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/10] e2fsck: fix j_maxlen if the file system is exactly 1 << 32 blocks
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
` (5 preceding siblings ...)
2013-12-03 5:10 ` [PATCH 06/10] libext2fs: add explicit casts to bitops.h Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 08/10] e2fsck: add support for 64-bit extended attribute block refcounting Theodore Ts'o
` (2 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
If the external journal device has exactly 1 << 32 blocks,
journal->j_maxlen would get set to zero, which would cause e2fsck to
declare the journal to be invalid.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/journal.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index ff11f22..bd2c9a1 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -241,7 +241,6 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
unsigned long long start = 0;
int ext_journal = 0;
int tried_backup_jnl = 0;
- blk64_t maxlen;
clear_problem_context(&pctx);
@@ -392,6 +391,8 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
io_channel_set_blksize(ctx->journal_io, ctx->fs->blocksize);
if (ext_journal) {
+ blk64_t maxlen;
+
if (ctx->fs->blocksize == 1024)
start = 1;
bh = getblk(dev_journal, start, ctx->fs->blocksize);
@@ -426,9 +427,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
}
maxlen = ext2fs_blocks_count(&jsuper);
- if (maxlen > 1ULL << 32)
- maxlen = (1ULL << 32) - 1;
- journal->j_maxlen = maxlen;
+ journal->j_maxlen = (maxlen < 1ULL << 32) ? maxlen : (1ULL << 32) - 1;
start++;
}
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/10] e2fsck: add support for 64-bit extended attribute block refcounting
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
` (6 preceding siblings ...)
2013-12-03 5:10 ` [PATCH 07/10] e2fsck: fix j_maxlen if the file system is exactly 1 << 32 blocks Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 09/10] e2fsck: use dgrp_t for block group numbers Theodore Ts'o
2013-12-03 5:10 ` [PATCH 10/10] libext2fs: fix printf conversion spec in tst_iscan.c Theodore Ts'o
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
If we have a 64-bit file system with extended attribute blocks, e2fsck
would not correctly handle EA blocks that were located beyond the
32-bit block number boundary. Fix this by teaching
e2fsck/ea_refcount.c to use 64-bit block numbers.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/e2fsck.h | 11 +++++------
e2fsck/ea_refcount.c | 18 +++++++++---------
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 3c4f832..913a596 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -435,17 +435,16 @@ extern struct dx_dir_info *e2fsck_dx_dir_info_iter(e2fsck_t ctx, int *control);
/* ea_refcount.c */
extern errcode_t ea_refcount_create(int size, ext2_refcount_t *ret);
extern void ea_refcount_free(ext2_refcount_t refcount);
-extern errcode_t ea_refcount_fetch(ext2_refcount_t refcount, blk_t blk,
- int *ret);
+extern errcode_t ea_refcount_fetch(ext2_refcount_t refcount, blk64_t blk, int *ret);
extern errcode_t ea_refcount_increment(ext2_refcount_t refcount,
- blk_t blk, int *ret);
+ blk64_t blk, int *ret);
extern errcode_t ea_refcount_decrement(ext2_refcount_t refcount,
- blk_t blk, int *ret);
+ blk64_t blk, int *ret);
extern errcode_t ea_refcount_store(ext2_refcount_t refcount,
- blk_t blk, int count);
+ blk64_t blk, int count);
extern blk_t ext2fs_get_refcount_size(ext2_refcount_t refcount);
extern void ea_refcount_intr_begin(ext2_refcount_t refcount);
-extern blk_t ea_refcount_intr_next(ext2_refcount_t refcount, int *ret);
+extern blk64_t ea_refcount_intr_next(ext2_refcount_t refcount, int *ret);
/* ehandler.c */
extern const char *ehandler_operation(const char *op);
diff --git a/e2fsck/ea_refcount.c b/e2fsck/ea_refcount.c
index e66e636..3836c5d 100644
--- a/e2fsck/ea_refcount.c
+++ b/e2fsck/ea_refcount.c
@@ -25,7 +25,7 @@
* checked, its bit is set in the block_ea_map bitmap.
*/
struct ea_refcount_el {
- blk_t ea_blk;
+ blk64_t ea_blk;
int ea_count;
};
@@ -111,7 +111,7 @@ static void refcount_collapse(ext2_refcount_t refcount)
* specified position.
*/
static struct ea_refcount_el *insert_refcount_el(ext2_refcount_t refcount,
- blk_t blk, int pos)
+ blk64_t blk, int pos)
{
struct ea_refcount_el *el;
errcode_t retval;
@@ -153,7 +153,7 @@ static struct ea_refcount_el *insert_refcount_el(ext2_refcount_t refcount,
* and we can't find an entry, create one in the sorted list.
*/
static struct ea_refcount_el *get_refcount_el(ext2_refcount_t refcount,
- blk_t blk, int create)
+ blk64_t blk, int create)
{
int low, high, mid;
@@ -206,7 +206,7 @@ retry:
return 0;
}
-errcode_t ea_refcount_fetch(ext2_refcount_t refcount, blk_t blk,
+errcode_t ea_refcount_fetch(ext2_refcount_t refcount, blk64_t blk,
int *ret)
{
struct ea_refcount_el *el;
@@ -220,7 +220,7 @@ errcode_t ea_refcount_fetch(ext2_refcount_t refcount, blk_t blk,
return 0;
}
-errcode_t ea_refcount_increment(ext2_refcount_t refcount, blk_t blk, int *ret)
+errcode_t ea_refcount_increment(ext2_refcount_t refcount, blk64_t blk, int *ret)
{
struct ea_refcount_el *el;
@@ -234,7 +234,7 @@ errcode_t ea_refcount_increment(ext2_refcount_t refcount, blk_t blk, int *ret)
return 0;
}
-errcode_t ea_refcount_decrement(ext2_refcount_t refcount, blk_t blk, int *ret)
+errcode_t ea_refcount_decrement(ext2_refcount_t refcount, blk64_t blk, int *ret)
{
struct ea_refcount_el *el;
@@ -249,7 +249,7 @@ errcode_t ea_refcount_decrement(ext2_refcount_t refcount, blk_t blk, int *ret)
return 0;
}
-errcode_t ea_refcount_store(ext2_refcount_t refcount, blk_t blk, int count)
+errcode_t ea_refcount_store(ext2_refcount_t refcount, blk64_t blk, int count)
{
struct ea_refcount_el *el;
@@ -277,7 +277,7 @@ void ea_refcount_intr_begin(ext2_refcount_t refcount)
}
-blk_t ea_refcount_intr_next(ext2_refcount_t refcount,
+blk64_t ea_refcount_intr_next(ext2_refcount_t refcount,
int *ret)
{
struct ea_refcount_el *list;
@@ -370,7 +370,7 @@ int main(int argc, char **argv)
int i = 0;
ext2_refcount_t refcount;
int size, arg;
- blk_t blk;
+ blk64_t blk;
errcode_t retval;
while (1) {
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/10] e2fsck: use dgrp_t for block group numbers
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
` (7 preceding siblings ...)
2013-12-03 5:10 ` [PATCH 08/10] e2fsck: add support for 64-bit extended attribute block refcounting Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
2013-12-03 5:10 ` [PATCH 10/10] libext2fs: fix printf conversion spec in tst_iscan.c Theodore Ts'o
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Theodore Ts'o
Make e2fsck consistently use dgrp_t for bloc group numbers to avoid
-Wconveresion noise.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/journal.c | 3 ++-
e2fsck/message.c | 2 +-
e2fsck/pass1.c | 8 +++++---
e2fsck/pass2.c | 2 +-
e2fsck/pass4.c | 2 +-
e2fsck/pass5.c | 16 ++++++++--------
e2fsck/problem.h | 2 +-
7 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index bd2c9a1..eb891ca 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -945,7 +945,8 @@ void e2fsck_move_ext3_journal(e2fsck_t ctx)
ext2_ino_t ino;
errcode_t retval;
const char * const * cpp;
- int group, mount_flags;
+ dgrp_t group;
+ int mount_flags;
clear_problem_context(&pctx);
diff --git a/e2fsck/message.c b/e2fsck/message.c
index 80af1af..7b2cb62 100644
--- a/e2fsck/message.c
+++ b/e2fsck/message.c
@@ -450,7 +450,7 @@ static _INLINE_ void expand_percent_expression(FILE *f, ext2_filsys fs,
fprintf(f, "%*u", width, ctx->dir);
break;
case 'g':
- fprintf(f, "%*d", width, ctx->group);
+ fprintf(f, "%*u", width, ctx->group);
break;
case 'i':
fprintf(f, "%*u", width, ctx->ino);
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 3cf4aac..a853413 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -2004,7 +2004,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
struct process_block_struct pb;
ext2_ino_t ino = pctx->ino;
struct ext2_inode *inode = pctx->inode;
- int bad_size = 0;
+ unsigned bad_size = 0;
int dirty_inode = 0;
int extent_fs;
__u64 size;
@@ -2566,14 +2566,16 @@ static int process_bad_block(ext2_filsys fs,
return 0;
}
-static void new_table_block(e2fsck_t ctx, blk64_t first_block, int group,
+static void new_table_block(e2fsck_t ctx, blk64_t first_block, dgrp_t group,
const char *name, int num, blk64_t *new_block)
{
ext2_filsys fs = ctx->fs;
dgrp_t last_grp;
blk64_t old_block = *new_block;
blk64_t last_block;
- int i, is_flexbg, flexbg, flexbg_size;
+ dgrp_t flexbg;
+ unsigned flexbg_size;
+ int i, is_flexbg;
char *buf;
struct problem_context pctx;
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 6ef17d3..65d8de4 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -844,7 +844,7 @@ out_htree:
dict_init(&de_dict, DICTCOUNT_T_MAX, dict_de_cmp);
prev = 0;
do {
- int group;
+ dgrp_t group;
ext2_ino_t first_unused_inode;
problem = 0;
diff --git a/e2fsck/pass4.c b/e2fsck/pass4.c
index 2d55180..21d93f0 100644
--- a/e2fsck/pass4.c
+++ b/e2fsck/pass4.c
@@ -99,7 +99,7 @@ void e2fsck_pass4(e2fsck_t ctx)
struct problem_context pctx;
__u16 link_count, link_counted;
char *buf = 0;
- int group, maxgroup;
+ dgrp_t group, maxgroup;
init_resource_track(&rtrack, ctx->fs->io);
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index feaa83e..d4bdbd8 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -196,7 +196,7 @@ static void check_block_bitmaps(e2fsck_t ctx)
ext2_filsys fs = ctx->fs;
blk64_t i;
unsigned int *free_array;
- int group = 0;
+ dgrp_t g, group = 0;
unsigned int blocks = 0;
blk64_t free_blocks = 0;
blk64_t first_free = ext2fs_blocks_count(fs->super);
@@ -498,15 +498,15 @@ redo_counts:
} else if (fixit == 0)
ext2fs_unmark_valid(fs);
- for (i = 0; i < fs->group_desc_count; i++) {
- if (free_array[i] != ext2fs_bg_free_blocks_count(fs, i)) {
- pctx.group = i;
- pctx.blk = ext2fs_bg_free_blocks_count(fs, i);
- pctx.blk2 = free_array[i];
+ for (g = 0; g < fs->group_desc_count; g++) {
+ if (free_array[g] != ext2fs_bg_free_blocks_count(fs, g)) {
+ pctx.group = g;
+ pctx.blk = ext2fs_bg_free_blocks_count(fs, g);
+ pctx.blk2 = free_array[g];
if (fix_problem(ctx, PR_5_FREE_BLOCK_COUNT_GROUP,
&pctx)) {
- ext2fs_bg_free_blocks_count_set(fs, i, free_array[i]);
+ ext2fs_bg_free_blocks_count_set(fs, g, free_array[g]);
ext2fs_mark_super_dirty(fs);
} else
ext2fs_unmark_valid(fs);
@@ -536,7 +536,7 @@ static void check_inode_bitmaps(e2fsck_t ctx)
unsigned int free_inodes = 0;
int group_free = 0;
int dirs_count = 0;
- int group = 0;
+ dgrp_t group = 0;
unsigned int inodes = 0;
ext2_ino_t *free_array;
ext2_ino_t *dir_array;
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index 4e7c9cd..6cb09cf 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -18,7 +18,7 @@ struct problem_context {
struct ext2_dir_entry *dirent;
blk64_t blk, blk2;
e2_blkcnt_t blkcount;
- int group;
+ dgrp_t group;
__u32 csum1, csum2;
__u64 num;
const char *str;
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/10] libext2fs: fix printf conversion spec in tst_iscan.c
2013-12-03 5:10 ` [PATCH 00/10] Fix 64-bit type conversion issues in e2fsck Theodore Ts'o
` (8 preceding siblings ...)
2013-12-03 5:10 ` [PATCH 09/10] e2fsck: use dgrp_t for block group numbers Theodore Ts'o
@ 2013-12-03 5:10 ` Theodore Ts'o
9 siblings, 0 replies; 17+ messages in thread
From: Theodore Ts'o @ 2013-12-03 5:10 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Kit Westneat, Eric Whitney, Theodore Ts'o
From: Eric Whitney <enwlinux@gmail.com>
A recent patch to fix blk_t to blk64_t assignment mismatches in
e2fsprogs (commit 4dbfd79d1458ce1259b951377e341aeb6197f8c1) created
a printf conversion spec / argument type mismatch in tst_iscan.c.
Fix this to avoid truncation of the printed value and to silence
a compiler warning seen when "make check" is run.
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/tst_iscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ext2fs/tst_iscan.c b/lib/ext2fs/tst_iscan.c
index a95296c..70bfbec 100644
--- a/lib/ext2fs/tst_iscan.c
+++ b/lib/ext2fs/tst_iscan.c
@@ -182,7 +182,7 @@ 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 --- %u\n", test_vec[i]);
+ printf("Bad block was touched --- %llu\n", test_vec[i]);
failed++;
first_no_comma = 1;
}
--
1.8.5.rc3.362.gdf10213
^ permalink raw reply related [flat|nested] 17+ messages in thread