From df0b907ec1625b058814f42119c9a736f2c34c96 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 13 Jul 2015 15:36:19 -0400 Subject: [PATCH] debugfs: cleanup gcc -Wall warnings Signed-off-by: Theodore Ts'o --- debugfs/debugfs.c | 4 ++-- debugfs/debugfs.h | 8 ++++++++ debugfs/do_journal.c | 14 ++------------ debugfs/htree.c | 8 ++++---- debugfs/journal.c | 6 +++--- debugfs/journal.h | 25 +++++++++++++++++++++++++ debugfs/logdump.c | 17 +++++++++++++++++ e2fsck/jfs_user.h | 17 ----------------- 8 files changed, 61 insertions(+), 38 deletions(-) create mode 100644 debugfs/journal.h diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index e5134bf..583cf8b 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 6972d50..fa2aacb 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 ef0db2e..5c2c2a2 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 866d1c6..83f558c 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 82d5bca..9f0d7fc 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 0000000..10b638e --- /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 70a7c36..885e590 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 e580b27..be81f43 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! */ -- 1.8.3.1