aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2023-01-27 15:23:12 -0500
committerTheodore Ts'o <tytso@mit.edu>2023-01-27 15:23:12 -0500
commit4d91d64b5a97a27b9e5fbc6cff11ca69ea887cf6 (patch)
tree9a52442d525ecf53abbea16001f2758b31446eef
parent9fd9c75204c5c1c021fa9911b787e62e9657802e (diff)
downloade2fsprogs-4d91d64b5a97a27b9e5fbc6cff11ca69ea887cf6.tar.gz
e2fsck: use ext2_ino_t instead of ino_t
The ino_t type is defined by the system header files, and may be anything from an unsigned int, unsigned long, or an unsigned long long. So where we are referring to an ext2/ext3/ext4 inode number, we should use ext2_ino_t to avoid this ambiguity, especially when passing an inode number to a printf-style function. This was detected via a compiler warning on MacOS, but it's potentially a real bug, since it can cause an error message to print a garbled inode number. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--e2fsck/journal.c12
-rw-r--r--e2fsck/pass1.c8
-rw-r--r--e2fsck/rehash.c2
3 files changed, 11 insertions, 11 deletions
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index bb86f5282..8ae89bf7b 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -578,7 +578,7 @@ static int ext4_del_extent_from_list(e2fsck_t ctx, struct extent_list *list,
return ext4_modify_extent_list(ctx, list, ex, 1 /* delete */);
}
-static int ext4_fc_read_extents(e2fsck_t ctx, ino_t ino)
+static int ext4_fc_read_extents(e2fsck_t ctx, ext2_ino_t ino)
{
struct extent_list *extent_list = &ctx->fc_replay_state.fc_extent_list;
@@ -597,7 +597,7 @@ static int ext4_fc_read_extents(e2fsck_t ctx, ino_t ino)
* for the inode so that we can flush all of them at once and it also saves us
* from continuously growing and shrinking the extent tree.
*/
-static void ext4_fc_flush_extents(e2fsck_t ctx, ino_t ino)
+static void ext4_fc_flush_extents(e2fsck_t ctx, ext2_ino_t ino)
{
struct extent_list *extent_list = &ctx->fc_replay_state.fc_extent_list;
@@ -610,9 +610,9 @@ static void ext4_fc_flush_extents(e2fsck_t ctx, ino_t ino)
/* Helper struct for dentry replay routines */
struct dentry_info_args {
- ino_t parent_ino;
+ ext2_ino_t parent_ino;
int dname_len;
- ino_t ino;
+ ext2_ino_t ino;
char *dname;
};
@@ -634,7 +634,7 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
val + sizeof(struct ext4_fc_dentry_info),
darg->dname_len);
darg->dname[darg->dname_len] = 0;
- jbd_debug(1, "%s: %s, ino %lu, parent %lu\n",
+ jbd_debug(1, "%s: %s, ino %u, parent %u\n",
le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_CREAT ? "create" :
(le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_LINK ? "link" :
(le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_UNLINK ? "unlink" :
@@ -809,7 +809,7 @@ static int ext4_fc_handle_add_extent(e2fsck_t ctx, __u8 *val)
{
struct ext2fs_extent extent;
struct ext4_fc_add_range add_range;
- ino_t ino;
+ ext2_ino_t ino;
int ret = 0;
memcpy(&add_range, val, sizeof(add_range));
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index f8dcf61af..bcf337c22 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -79,8 +79,8 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
static void mark_table_blocks(e2fsck_t ctx);
static void alloc_bb_map(e2fsck_t ctx);
static void alloc_imagic_map(e2fsck_t ctx);
-static void mark_inode_bad(e2fsck_t ctx, ino_t ino);
-static void add_casefolded_dir(e2fsck_t ctx, ino_t ino);
+static void mark_inode_bad(e2fsck_t ctx, ext2_ino_t ino);
+static void add_casefolded_dir(e2fsck_t ctx, ext2_ino_t ino);
static void handle_fs_bad_blocks(e2fsck_t ctx);
static void process_inodes(e2fsck_t ctx, char *block_buf);
static EXT2_QSORT_TYPE process_inode_cmp(const void *a, const void *b);
@@ -2205,7 +2205,7 @@ static EXT2_QSORT_TYPE process_inode_cmp(const void *a, const void *b)
/*
* Mark an inode as being bad in some what
*/
-static void mark_inode_bad(e2fsck_t ctx, ino_t ino)
+static void mark_inode_bad(e2fsck_t ctx, ext2_ino_t ino)
{
struct problem_context pctx;
@@ -2226,7 +2226,7 @@ static void mark_inode_bad(e2fsck_t ctx, ino_t ino)
ext2fs_mark_inode_bitmap2(ctx->inode_bad_map, ino);
}
-static void add_casefolded_dir(e2fsck_t ctx, ino_t ino)
+static void add_casefolded_dir(e2fsck_t ctx, ext2_ino_t ino)
{
struct problem_context pctx;
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index c79a5acf9..8235e468e 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -91,7 +91,7 @@ struct fill_dir_struct {
struct hash_entry {
ext2_dirhash_t hash;
ext2_dirhash_t minor_hash;
- ino_t ino;
+ ext2_ino_t ino;
struct ext2_dir_entry *dir;
};