Whamcloud - gitweb
Fix various compiler -Wall warnings
authorTheodore Ts'o <tytso@mit.edu>
Wed, 24 Apr 2024 04:04:59 +0000 (00:04 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 24 Apr 2024 04:11:37 +0000 (00:11 -0400)
Fixes: a12302fa683e ("e2fsck: make sure get_backup_sb() works ...")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/e2fsck.h
e2fsck/problem.c
e2fsck/super.c
e2fsck/util.c
lib/ext2fs/ext2fs.h
misc/create_inode_libarchive.c
misc/fuse2fs.c
misc/tune2fs.c

index 3f2dc30..55738fd 100644 (file)
@@ -663,7 +663,8 @@ extern void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned long size,
                                    const char *description);
 extern int ask(e2fsck_t ctx, const char * string, int def);
 extern int ask_yn(e2fsck_t ctx, const char * string, int def);
-extern void fatal_error(e2fsck_t ctx, const char * fmt_string);
+extern void fatal_error(e2fsck_t ctx, const char * fmt_string)
+       E2FSCK_ATTR((noreturn));
 extern void log_out(e2fsck_t ctx, const char *fmt, ...)
        E2FSCK_ATTR((format(printf, 2, 3)));
 extern void log_err(e2fsck_t ctx, const char *fmt, ...)
index 013ace2..207ebbb 100644 (file)
@@ -2689,7 +2689,7 @@ void print_e2fsck_message(FILE *f, e2fsck_t ctx, const char *msg,
 
 void fatal_error(e2fsck_t ctx, const char *msg)
 {
-       return;
+       exit(0);
 }
 
 void preenhalt(e2fsck_t ctx)
index 757a475..051dc96 100644 (file)
@@ -1323,7 +1323,7 @@ void check_super_block(e2fsck_t ctx)
            (ext2fs_get_tstamp(fs->super, s_mtime) > ctx->now)) {
                pctx.num = ext2fs_get_tstamp(fs->super, s_mtime);
                problem = PR_0_FUTURE_SB_LAST_MOUNT;
-               if (pctx.num <= ctx->now + ctx->time_fudge)
+               if ((time_t) pctx.num <= ctx->now + ctx->time_fudge)
                        problem = PR_0_FUTURE_SB_LAST_MOUNT_FUDGED;
                if (fix_problem(ctx, problem, &pctx)) {
                        ext2fs_set_tstamp(fs->super, s_mtime, ctx->now);
@@ -1335,7 +1335,7 @@ void check_super_block(e2fsck_t ctx)
            (ext2fs_get_tstamp(fs->super, s_wtime) > ctx->now)) {
                pctx.num = ext2fs_get_tstamp(fs->super, s_wtime);
                problem = PR_0_FUTURE_SB_LAST_WRITE;
-               if (pctx.num <= ctx->now + ctx->time_fudge)
+               if ((time_t) pctx.num <= ctx->now + ctx->time_fudge)
                        problem = PR_0_FUTURE_SB_LAST_WRITE_FUDGED;
                if (fix_problem(ctx, problem, &pctx)) {
                        ext2fs_set_tstamp(fs->super, s_wtime, ctx->now);
index b8deb41..27b3a0d 100644 (file)
@@ -560,7 +560,7 @@ blk64_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs, const char *name,
        struct ext2_super_block *sb;
        io_channel              io = NULL;
        void                    *buf = NULL;
-       int                     blocksize = EXT2_MIN_BLOCK_SIZE;
+       unsigned int            blocksize = EXT2_MIN_BLOCK_SIZE;
        int                     blocksize_known = 0;
        blk_t                   bpg = 0;
        blk64_t                 ret_sb = 8193;
@@ -593,7 +593,7 @@ blk64_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs, const char *name,
                blk64_t num_blocks;
 
                if (fs && fs->super) {
-                       num_blocks = ext2fs_blocks_count(fs->super);
+                       limit = ext2fs_blocks_count(fs->super) / this_bpg;
                } else if (ctx && ext2fs_get_device_size2(ctx->filesystem_name,
                                                          blocksize,
                                                          &num_blocks) == 0) {
@@ -622,7 +622,7 @@ blk64_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs, const char *name,
                                ext2fs_swap_super(sb);
 #endif
                        if ((sb->s_magic == EXT2_SUPER_MAGIC) &&
-                           (EXT2_BLOCK_SIZE(sb) == blocksize)) {
+                           ((unsigned) EXT2_BLOCK_SIZE(sb) == blocksize)) {
                                ret_sb = superblock;
                                if (ctx) {
                                        ctx->superblock = superblock;
index a325913..624c1a1 100644 (file)
@@ -601,10 +601,10 @@ static inline __u32 __decode_extra_nsec(__u32 extra)
 {
        return (extra & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
 }
-#define ext2fs_inode_actual_size(inode)                                      \
-       (EXT2_GOOD_OLD_INODE_SIZE +                                           \
-        (sizeof(*inode) > EXT2_GOOD_OLD_INODE_SIZE ?                         \
-               ((struct ext2_inode_large *)(inode))->i_extra_isize : 0))
+#define ext2fs_inode_actual_size(inode)                                              \
+       ((size_t)(EXT2_GOOD_OLD_INODE_SIZE +                                  \
+                 (sizeof(*inode) > EXT2_GOOD_OLD_INODE_SIZE ?                \
+                  ((struct ext2_inode_large *)(inode))->i_extra_isize : 0)))
 #define clamp(val, min, max) ((val) < (min) ? (min) : ((val) > (max) ?       \
                                                       (max) : (val)))
 #define ext2fs_inode_xtime_set(inode, field, sec)                            \
index 9ed80ee..d7822d8 100644 (file)
@@ -352,7 +352,6 @@ static errcode_t do_write_internal_tar(ext2_filsys fs, ext2_ino_t cwd,
        ext2_ino_t newfile;
        errcode_t retval;
        struct ext2_inode inode;
-       char *cp;
 
        retval = ext2fs_new_inode(fs, cwd, 010755, 0, &newfile);
        if (retval)
@@ -547,7 +546,7 @@ static errcode_t handle_entry(ext2_filsys fs, ext2_ino_t root_ino,
 
 errcode_t __populate_fs_from_tar(ext2_filsys fs, ext2_ino_t root_ino,
                                 const char *source_tar, ext2_ino_t root,
-                                struct hdlinks_s *hdlinks,
+                                struct hdlinks_s *hdlinks EXT2FS_ATTR((unused)),
                                 struct file_info *target,
                                 struct fs_ops_callbacks *fs_callbacks)
 {
index 5c75966..ed2558d 100644 (file)
@@ -735,7 +735,7 @@ static void op_destroy(void *p EXT2FS_ATTR((unused)))
 
 static void *op_init(struct fuse_conn_info *conn
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , struct fuse_config *cfg
+                       , struct fuse_config *cfg EXT2FS_ATTR((unused))
 #endif
                        )
 {
@@ -809,7 +809,7 @@ static int stat_inode(ext2_filsys fs, ext2_ino_t ino, struct stat *statbuf)
 
 static int op_getattr(const char *path, struct stat *statbuf
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , struct fuse_file_info *fi
+                       , struct fuse_file_info *fi EXT2FS_ATTR((unused))
 #endif
                        )
 {
@@ -1557,7 +1557,7 @@ static int update_dotdot_helper(ext2_ino_t dir EXT2FS_ATTR((unused)),
 
 static int op_rename(const char *from, const char *to
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , unsigned int flags
+                       , unsigned int flags EXT2FS_ATTR((unused))
 #endif
                        )
 {
@@ -1890,7 +1890,7 @@ out:
 
 static int op_chmod(const char *path, mode_t mode
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , struct fuse_file_info *fi
+                       , struct fuse_file_info *fi EXT2FS_ATTR((unused))
 #endif
                        )
 {
@@ -1953,7 +1953,7 @@ out:
 
 static int op_chown(const char *path, uid_t owner, gid_t group
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , struct fuse_file_info *fi
+                       , struct fuse_file_info *fi EXT2FS_ATTR((unused))
 #endif
                        )
 {
@@ -2027,7 +2027,7 @@ out:
 
 static int op_truncate(const char *path, off_t len
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , struct fuse_file_info *fi
+                       , struct fuse_file_info *fi EXT2FS_ATTR((unused))
 #endif
                        )
 {
@@ -2798,7 +2798,7 @@ static int op_readdir(const char *path EXT2FS_ATTR((unused)),
                      off_t offset EXT2FS_ATTR((unused)),
                      struct fuse_file_info *fp
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , enum fuse_readdir_flags flags
+                       , enum fuse_readdir_flags flags EXT2FS_ATTR((unused))
 #endif
                        )
 {
@@ -3066,7 +3066,7 @@ static int op_fgetattr(const char *path EXT2FS_ATTR((unused)),
 
 static int op_utimens(const char *path, const struct timespec ctv[2]
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
-                       , struct fuse_file_info *fi
+                       , struct fuse_file_info *fi EXT2FS_ATTR((unused))
 #endif
                        )
 {
index d7401f7..6de40e9 100644 (file)
@@ -3097,7 +3097,7 @@ static int handle_fslabel(int setlabel)
        errcode_t ret;
        int mnt_flags, fd;
        char label[FSLABEL_MAX];
-       int maxlen = FSLABEL_MAX - 1;
+       unsigned int maxlen = FSLABEL_MAX - 1;
        char mntpt[PATH_MAX + 1];
 
        ret = ext2fs_check_mount_point(device_name, &mnt_flags,