From: Theodore Ts'o Date: Mon, 13 Jul 2015 19:36:19 +0000 (-0400) Subject: debugfs: cleanup gcc -Wall warnings X-Git-Tag: v1.43-WIP-2016-03-15~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df0b907ec1625b058814f42119c9a736f2c34c96;p=thirdparty%2Fe2fsprogs.git debugfs: cleanup gcc -Wall warnings Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index e5134bf87..583cf8b67 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -782,11 +782,11 @@ static void dump_fast_link(FILE *out, ext2_ino_t inode_num, if (retval) goto out; } else { - int sz = EXT2_I_SIZE(inode); + size_t sz = EXT2_I_SIZE(inode); if (sz > sizeof(inode->i_block)) sz = sizeof(inode->i_block); - fprintf(out, "%sFast link dest: \"%.*s\"\n", prefix, sz, + fprintf(out, "%sFast link dest: \"%.*s\"\n", prefix, (int) sz, (char *)inode->i_block); } out: diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h index 6972d5024..fa2aacb17 100644 --- a/debugfs/debugfs.h +++ b/debugfs/debugfs.h @@ -163,6 +163,7 @@ extern void do_expand_dir(int argc, char **argv); extern void do_features(int argc, char **argv); extern void do_bmap(int argc, char **argv); extern void do_imap(int argc, char **argv); +extern void do_idump(int argc, char *argv[]); extern void do_set_current_time(int argc, char **argv); extern void do_supported_features(int argc, char **argv); extern void do_punch(int argc, char **argv); @@ -175,6 +176,13 @@ extern void do_set_mmp_value(int argc, char **argv); extern void do_freefrag(int argc, char **argv); extern void do_filefrag(int argc, char *argv[]); +/* do_journal.c */ + +extern void do_journal_write(int argc, char *argv[]); +extern void do_journal_open(int argc, char *argv[]); +extern void do_journal_close(int argc, char *argv[]); +extern void do_journal_run(int argc, char *argv[]); + /* quota.c */ extern void do_list_quota(int argc, char *argv[]); extern void do_get_quota(int argc, char *argv[]); diff --git a/debugfs/do_journal.c b/debugfs/do_journal.c index ef0db2e94..5c2c2a2a0 100644 --- a/debugfs/do_journal.c +++ b/debugfs/do_journal.c @@ -20,18 +20,8 @@ extern char *optarg; #endif #include "debugfs.h" -#include "jfs_user.h" #include "ext2fs/kernel-jbd.h" - -/* journal.c */ -errcode_t ext2fs_open_journal(ext2_filsys fs, journal_t **j); -errcode_t ext2fs_close_journal(ext2_filsys fs, journal_t **j); -errcode_t ext2fs_run_ext3_journal(ext2_filsys *fs); -void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh); -void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh); -void jbd2_descr_block_csum_set(journal_t *j, struct buffer_head *bh); -void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, - struct buffer_head *bh, __u32 sequence); +#include "journal.h" #undef DEBUG @@ -660,7 +650,7 @@ static int count_tags(journal_t *journal, char *buf) return nr; } -errcode_t journal_find_head(journal_t *journal) +static errcode_t journal_find_head(journal_t *journal) { unsigned int next_commit_ID; blk64_t next_log_block, head_block; diff --git a/debugfs/htree.c b/debugfs/htree.c index 866d1c6b6..83f558c4c 100644 --- a/debugfs/htree.c +++ b/debugfs/htree.c @@ -83,7 +83,7 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino, if (((offset + rec_len) > fs->blocksize) || (rec_len < 8) || ((rec_len % 4) != 0) || - (thislen + 8 > rec_len)) { + ((unsigned) thislen + 8 > rec_len)) { fprintf(pager, "Corrupted directory block (%llu)!\n", blk); break; @@ -174,12 +174,12 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, fprintf(pager, "\n"); for (i=0; i < count; i++) { - int hash, block; + unsigned int hashval, block; - hash = ext2fs_le32_to_cpu(ent[i].hash); + hashval = ext2fs_le32_to_cpu(ent[i].hash); block = ext2fs_le32_to_cpu(ent[i].block); fprintf(pager, "Entry #%d: Hash 0x%08x, block %u\n", i, - i ? hash : 0, block); + i ? hashval : 0, block); if (level) htree_dump_int_block(fs, ino, inode, rootnode, block, buf, level-1); diff --git a/debugfs/journal.c b/debugfs/journal.c index 82d5bca3d..9f0d7fcad 100644 --- a/debugfs/journal.c +++ b/debugfs/journal.c @@ -23,8 +23,8 @@ #endif #define E2FSCK_INCLUDE_INLINE_FUNCS -#include "jfs_user.h" #include "uuid/uuid.h" +#include "journal.h" #ifdef CONFIG_JBD_DEBUG /* Enabled by configure --enable-jfs-debug */ static int bh_count = 0; @@ -640,7 +640,7 @@ static errcode_t ext2fs_journal_load(journal_t *journal) return 0; } -void ext2fs_journal_release(ext2_filsys fs, journal_t *journal, +static void ext2fs_journal_release(ext2_filsys fs, journal_t *journal, int reset, int drop) { journal_superblock_t *jsb; @@ -676,7 +676,7 @@ void ext2fs_journal_release(ext2_filsys fs, journal_t *journal, * This function makes sure that the superblock fields regarding the * journal are consistent. */ -errcode_t ext2fs_check_ext3_journal(ext2_filsys fs) +static errcode_t ext2fs_check_ext3_journal(ext2_filsys fs) { struct ext2_super_block *sb = fs->super; journal_t *journal; diff --git a/debugfs/journal.h b/debugfs/journal.h new file mode 100644 index 000000000..10b638eba --- /dev/null +++ b/debugfs/journal.h @@ -0,0 +1,25 @@ +/* + * journal.h + * + * Copyright (C) 2000 Andreas Dilger + * Copyright (C) 2000 Theodore Ts'o + * + * Parts of the code are based on fs/jfs/journal.c by Stephen C. Tweedie + * Copyright (C) 1999 Red Hat Software + * + * This file may be redistributed under the terms of the + * GNU General Public License version 2 or at your discretion + * any later version. + */ + +#include "jfs_user.h" + +/* journal.c */ +errcode_t ext2fs_open_journal(ext2_filsys fs, journal_t **j); +errcode_t ext2fs_close_journal(ext2_filsys fs, journal_t **j); +errcode_t ext2fs_run_ext3_journal(ext2_filsys *fs); +void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh); +void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh); +void jbd2_descr_block_csum_set(journal_t *j, struct buffer_head *bh); +void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, + struct buffer_head *bh, __u32 sequence); diff --git a/debugfs/logdump.c b/debugfs/logdump.c index 70a7c3630..885e59008 100644 --- a/debugfs/logdump.c +++ b/debugfs/logdump.c @@ -468,6 +468,23 @@ static void dump_journal(char *cmdname, FILE *out_file, } } +static inline size_t journal_super_tag_bytes(journal_superblock_t *jsb) +{ + size_t sz; + + if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V3)) + return sizeof(journal_block_tag3_t); + + sz = sizeof(journal_block_tag_t); + + if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V2)) + sz += sizeof(__u16); + + if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_64BIT)) + return sz; + + return sz - sizeof(__u32); +} static void dump_descriptor_block(FILE *out_file, struct journal_source *source, diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h index e580b2722..be81f43f1 100644 --- a/e2fsck/jfs_user.h +++ b/e2fsck/jfs_user.h @@ -167,23 +167,6 @@ void wait_on_buffer(struct buffer_head *bh); #define JSB_HAS_INCOMPAT_FEATURE(jsb, mask) \ ((jsb)->s_header.h_blocktype == ext2fs_cpu_to_be32(JFS_SUPERBLOCK_V2) && \ ((jsb)->s_feature_incompat & ext2fs_cpu_to_be32((mask)))) -static inline size_t journal_super_tag_bytes(journal_superblock_t *jsb) -{ - size_t sz; - - if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V3)) - return sizeof(journal_block_tag3_t); - - sz = sizeof(journal_block_tag_t); - - if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_CSUM_V2)) - sz += sizeof(__u16); - - if (JSB_HAS_INCOMPAT_FEATURE(jsb, JFS_FEATURE_INCOMPAT_64BIT)) - return sz; - - return sz - sizeof(__u32); -} #else /* !DEBUGFS */ extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */