summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--e2fsck/ChangeLog8
-rw-r--r--e2fsck/jfs_user.h22
-rw-r--r--e2fsck/journal.c17
-rw-r--r--e2fsck/pass1.c11
-rw-r--r--e2fsck/pass1b.c14
-rw-r--r--e2fsck/pass3.c8
-rw-r--r--e2fsck/recovery.c10
-rw-r--r--e2fsck/revoke.c3
-rw-r--r--e2fsck/super.c26
-rw-r--r--e2fsck/unix.c5
-rw-r--r--e2fsck/util.c8
11 files changed, 78 insertions, 54 deletions
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 46d62544..3a683251 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,11 @@
+2001-01-06 <tytso@snap.thunk.org>
+
+ * journal.c, pass1.c, pass1b.c, pass3.c, recovery.c, revoke.c,
+ super.c, unix.c, util.c: Fix random gcc -Wall complaints.
+
+ * jfs_user.h: Use more sophisticated inline handling to allow
+ building with --enable-gcc-wall
+
2001-01-03 <tytso@snap.thunk.org>
* pass1.c (e2fsck_pass1): Moved journal inode handling out to its
diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h
index eaab0489..64d1c3c2 100644
--- a/e2fsck/jfs_user.h
+++ b/e2fsck/jfs_user.h
@@ -59,7 +59,24 @@ typedef struct {
#define kmalloc(len,flags) malloc(len)
#define kfree(p) free(p)
-static inline kmem_cache_t * do_cache_create(int len)
+/*
+ * We use the standard libext2fs portability tricks for inline
+ * functions.
+ */
+extern kmem_cache_t * do_cache_create(int len);
+
+#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
+#ifdef E2FSCK_INCLUDE_INLINE_FUNCS
+#define _INLINE_ extern
+#else
+#ifdef __GNUC__
+#define _INLINE_ extern __inline__
+#else /* For Watcom C */
+#define _INLINE_ extern inline
+#endif
+#endif
+
+_INLINE_ kmem_cache_t * do_cache_create(int len)
{
kmem_cache_t *new_cache;
new_cache = malloc(sizeof(*new_cache));
@@ -68,6 +85,9 @@ static inline kmem_cache_t * do_cache_create(int len)
return new_cache;
}
+#undef _INLINE_
+#endif
+
/*
* Now pull in the real linux/jfs.h definitions.
*/
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 88b1a530..960bfb47 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -20,6 +20,7 @@
#include <sys/stat.h>
#endif
+#define E2FSCK_INCLUDE_INLINE_FUNCS
#include "jfs_user.h"
#include "problem.h"
#include "uuid/uuid.h"
@@ -58,7 +59,7 @@ struct buffer_head *getblk(e2fsck_t ctx, blk_t blocknr, int blocksize)
return NULL;
jfs_debug(4, "getblk for block %lu (%d bytes)(total %d)\n",
- blocknr, blocksize, ++bh_count);
+ (unsigned long) blocknr, blocksize, ++bh_count);
bh->b_ctx = ctx;
bh->b_size = blocksize;
@@ -76,7 +77,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
bh = *bhp++;
if (rw == READ && !bh->b_uptodate) {
jfs_debug(3, "reading block %lu/%p\n",
- bh->b_blocknr, bh);
+ (unsigned long) bh->b_blocknr, (void *) bh);
retval = io_channel_read_blk(bh->b_ctx->fs->io,
bh->b_blocknr,
1, bh->b_data);
@@ -90,7 +91,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
bh->b_uptodate = 1;
} else if (rw == WRITE && bh->b_dirty) {
jfs_debug(3, "writing block %lu/%p\n",
- bh->b_blocknr, bh);
+ (unsigned long) bh->b_blocknr, (void *) bh);
retval = io_channel_write_blk(bh->b_ctx->fs->io,
bh->b_blocknr,
1, bh->b_data);
@@ -106,7 +107,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
} else
jfs_debug(3, "no-op %s for block %lu\n",
rw == READ ? "read" : "write",
- bh->b_blocknr);
+ (unsigned long) bh->b_blocknr);
}
}
@@ -120,7 +121,7 @@ void brelse(struct buffer_head *bh)
if (bh->b_dirty)
ll_rw_block(WRITE, 1, &bh);
jfs_debug(3, "freeing block %lu/%p (total %d)\n",
- bh->b_blocknr, bh, --bh_count);
+ (unsigned long) bh->b_blocknr, (void *) bh, --bh_count);
ext2fs_free_mem((void **) &bh);
}
@@ -151,7 +152,6 @@ static int e2fsck_journal_init_inode(e2fsck_t ctx,
ino_t journal_inum, journal_t **journal)
{
struct inode *inode;
- const char *cmdname = ctx->program_name;
struct buffer_head *bh;
blk_t start;
int retval;
@@ -210,8 +210,6 @@ static int e2fsck_get_journal(e2fsck_t ctx, journal_t **journal)
char uuid_str[40];
struct problem_context pctx;
struct ext2_super_block *sb = ctx->fs->super;
- int recover = ctx->fs->super->s_feature_incompat &
- EXT3_FEATURE_INCOMPAT_RECOVER;
clear_problem_context(&pctx);
@@ -394,7 +392,7 @@ static int e2fsck_journal_load(journal_t *journal)
return 0;
}
-void e2fsck_journal_reset_super(e2fsck_t ctx, journal_superblock_t *jsb,
+static void e2fsck_journal_reset_super(e2fsck_t ctx, journal_superblock_t *jsb,
journal_t *journal)
{
char *p;
@@ -567,7 +565,6 @@ no_has_journal:
static int recover_ext3_journal(e2fsck_t ctx)
{
- ext2_filsys fs = ctx->fs;
journal_t *journal;
int retval;
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index d09c064d..8fce3f34 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -410,15 +410,12 @@ void e2fsck_pass1(e2fsck_t ctx)
int problem = 0;
ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
- switch (ino) {
- case EXT2_BOOT_LOADER_INO:
+ if (ino == EXT2_BOOT_LOADER_INO) {
if (LINUX_S_ISDIR(inode.i_mode))
problem = PR_1_RESERVED_BAD_MODE;
- break;
- default:
+ } else {
if (inode.i_mode != 0)
problem = PR_1_RESERVED_BAD_MODE;
- break;
}
if (problem) {
if (fix_problem(ctx, problem, &pctx)) {
@@ -1004,7 +1001,7 @@ static char *describe_illegal_block(ext2_filsys fs, blk_t block)
/*
* This is a helper function for check_blocks().
*/
-int process_block(ext2_filsys fs,
+static int process_block(ext2_filsys fs,
blk_t *block_nr,
e2_blkcnt_t blockcnt,
blk_t ref_block,
@@ -1146,7 +1143,7 @@ static void bad_block_indirect(e2fsck_t ctx, blk_t blk)
ctx->flags |= E2F_FLAG_ABORT;
}
-int process_bad_block(ext2_filsys fs,
+static int process_bad_block(ext2_filsys fs,
blk_t *block_nr,
e2_blkcnt_t blockcnt,
blk_t ref_block,
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index b7d93304..11cad630 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -164,7 +164,6 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
ino_t ino;
struct ext2_inode inode;
ext2_inode_scan scan;
- errcode_t retval;
struct process_block_struct pb;
struct dup_inode *dp;
struct problem_context pctx;
@@ -231,12 +230,12 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
fs->check_directory = 0;
}
-int process_pass1b_block(ext2_filsys fs,
- blk_t *block_nr,
- e2_blkcnt_t blockcnt,
- blk_t ref_blk,
- int ref_offset,
- void *priv_data)
+static int process_pass1b_block(ext2_filsys fs,
+ blk_t *block_nr,
+ e2_blkcnt_t blockcnt,
+ blk_t ref_blk,
+ int ref_offset,
+ void *priv_data)
{
struct process_block_struct *p;
struct dup_block *dp, *q, *r;
@@ -524,7 +523,6 @@ static int delete_file_block(ext2_filsys fs,
static void delete_file(e2fsck_t ctx, struct dup_inode *dp, char* block_buf)
{
ext2_filsys fs = ctx->fs;
- errcode_t retval;
struct process_block_struct pb;
struct ext2_inode inode;
struct problem_context pctx;
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 695e3b87..32005a91 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -359,7 +359,7 @@ static int check_directory(e2fsck_t ctx, struct dir_info *dir,
* This routine gets the lost_and_found inode, making it a directory
* if necessary
*/
-ino_t get_lost_and_found(e2fsck_t ctx)
+static ino_t get_lost_and_found(e2fsck_t ctx)
{
ext2_filsys fs = ctx->fs;
ino_t ino;
@@ -367,7 +367,7 @@ ino_t get_lost_and_found(e2fsck_t ctx)
errcode_t retval;
struct ext2_inode inode;
char * block;
- const char name[] = "lost+found";
+ static const char name[] = "lost+found";
struct problem_context pctx;
struct dir_info *dirinfo;
@@ -487,7 +487,7 @@ ino_t get_lost_and_found(e2fsck_t ctx)
* Miscellaneous bookkeeping that needs to be kept straight.
*/
e2fsck_add_dir_info(ctx, ino, EXT2_ROOT_INO);
- adjust_inode_count(ctx, EXT2_ROOT_INO, +1);
+ adjust_inode_count(ctx, EXT2_ROOT_INO, 1);
ext2fs_icount_store(ctx->inode_count, ino, 2);
ext2fs_icount_store(ctx->inode_link_info, ino, 2);
#if 0
@@ -541,7 +541,7 @@ int e2fsck_reconnect_file(e2fsck_t ctx, ino_t ino)
fix_problem(ctx, PR_3_CANT_RECONNECT, &pctx);
return 1;
}
- adjust_inode_count(ctx, ino, +1);
+ adjust_inode_count(ctx, ino, 1);
return 0;
}
diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c
index 12af13d6..8ad13b8d 100644
--- a/e2fsck/recovery.c
+++ b/e2fsck/recovery.c
@@ -71,7 +71,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
unsigned int max, nbufs, next, blocknr;
struct buffer_head *bh;
- #define MAXBUF 8
+#define MAXBUF 8
struct buffer_head * bufs[MAXBUF];
/* Do up to 128K of readahead */
@@ -177,7 +177,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
* Count the number of in-use tags in a journal descriptor block.
*/
-int count_tags(struct buffer_head *bh, int size)
+static int count_tags(struct buffer_head *bh, int size)
{
char * tagp;
journal_block_tag_t * tag;
@@ -225,7 +225,9 @@ int journal_recover(journal_t *journal)
int err;
journal_superblock_t * sb;
- struct recovery_info info = {};
+ struct recovery_info info;
+
+ memset(&info, 0, sizeof(info));
sb = journal->j_superblock;
@@ -436,7 +438,7 @@ static int do_one_pass(journal_t *journal, struct recovery_info *info,
mark_buffer_dirty(nbh, 1);
++info->nr_replays;
- // ll_rw_block(WRITE, 1, &nbh);
+ /* ll_rw_block(WRITE, 1, &nbh); */
brelse(obh);
brelse(nbh);
}
diff --git a/e2fsck/revoke.c b/e2fsck/revoke.c
index 633f9756..e53b69b6 100644
--- a/e2fsck/revoke.c
+++ b/e2fsck/revoke.c
@@ -114,7 +114,8 @@ static inline int hash(journal_t *journal, unsigned long block)
(block << (hash_shift - 12))) & (table->hash_size - 1);
}
-int insert_revoke_hash(journal_t *journal, unsigned long blocknr, tid_t seq)
+static int insert_revoke_hash(journal_t *journal, unsigned long blocknr,
+ tid_t seq)
{
struct list_head *hash_list;
struct jfs_revoke_record_s *record;
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 8b8e04f4..23a6ddd5 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -90,14 +90,14 @@ static int release_inode_block(ext2_filsys fs,
if ((blk < fs->super->s_first_data_block) ||
(blk >= fs->super->s_blocks_count)) {
fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_BLOCK_NUM, pctx);
- abort:
+ return_abort:
pb->abort = 1;
return BLOCK_ABORT;
}
if (!ext2fs_test_block_bitmap(fs->block_map, blk)) {
fix_problem(ctx, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK, pctx);
- goto abort;
+ goto return_abort;
}
/*
@@ -112,17 +112,17 @@ static int release_inode_block(ext2_filsys fs,
*/
if (blockcnt < 0) {
int i, limit;
- blk_t *block_nr;
+ blk_t *bp;
pb->errcode = io_channel_read_blk(fs->io, blk, 1,
pb->buf);
if (pb->errcode)
- goto abort;
+ goto return_abort;
limit = fs->blocksize >> 2;
- for (i = 0, block_nr = (blk_t *) pb->buf;
- i < limit; i++, block_nr++)
- if (*block_nr)
+ for (i = 0, bp = (blk_t *) pb->buf;
+ i < limit; i++, bp++)
+ if (*bp)
return 0;
}
/*
@@ -139,13 +139,13 @@ static int release_inode_block(ext2_filsys fs,
pb->errcode = io_channel_read_blk(fs->io, blk, 1,
pb->buf);
if (pb->errcode)
- goto abort;
+ goto return_abort;
memset(pb->buf + pb->truncate_offset, 0,
fs->blocksize - pb->truncate_offset);
pb->errcode = io_channel_write_blk(fs->io, blk, 1,
pb->buf);
if (pb->errcode)
- goto abort;
+ goto return_abort;
}
pb->truncated_blocks++;
*block_nr = 0;
@@ -238,7 +238,7 @@ static int release_orphan_inodes(e2fsck_t ctx)
if ((ino < EXT2_FIRST_INODE(fs->super)) ||
(ino > fs->super->s_inodes_count)) {
clear_problem_context(&pctx);
- pctx.ino;
+ pctx.ino = ino;
fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_HEAD_INODE, &pctx);
return 1;
}
@@ -262,11 +262,11 @@ static int release_orphan_inodes(e2fsck_t ctx)
(next_ino > fs->super->s_inodes_count))) {
pctx.ino = next_ino;
fix_problem(ctx, PR_0_ORPHAN_ILLEGAL_INODE, &pctx);
- goto abort;
+ goto return_abort;
}
if (release_inode_blocks(ctx, ino, &inode, block_buf, &pctx))
- goto abort;
+ goto return_abort;
if (!inode.i_links_count) {
ext2fs_unmark_inode_bitmap(fs->inode_map, ino);
@@ -283,7 +283,7 @@ static int release_orphan_inodes(e2fsck_t ctx)
ino = next_ino;
}
return 0;
-abort:
+return_abort:
ext2fs_free_mem((void **) &block_buf);
return 1;
}
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index a22a19d0..34984e9a 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -73,7 +73,8 @@ static void usage(e2fsck_t ctx)
" -n Make no changes to the filesystem\n"
" -y Assume \"yes\" to all questions\n"
" -c Check for bad blocks\n"
- " -f Force checking even if filesystem is marked clean\n"
+ " -f Force checking even if filesystem is marked clean\n"));
+ fprintf(stderr, _(""
" -v Be verbose\n"
" -b superblock Use alternative superblock\n"
" -B blocksize Force blocksize when looking for superblock\n"
@@ -324,7 +325,7 @@ extern void e2fsck_clear_progbar(e2fsck_t ctx)
static int e2fsck_update_progress(e2fsck_t ctx, int pass,
unsigned long cur, unsigned long max)
{
- const char spinner[] = "\\|/-";
+ static const char spinner[] = "\\|/-";
char buf[80];
int i;
float percent;
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 9414ee97..1e2f9f0c 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -69,8 +69,8 @@ int ask_yn(const char * string, int def)
{
int c;
const char *defstr;
- char *short_yes = _("yY");
- char *short_no = _("nN");
+ const char *short_yes = _("yY");
+ const char *short_no = _("nN");
#ifdef HAVE_TERMIOS_H
struct termios termios, tmp;
@@ -212,8 +212,8 @@ void init_resource_track(struct resource_track *track)
track->brk_start = sbrk(0);
gettimeofday(&track->time_start, 0);
#ifdef HAVE_GETRUSAGE
-#ifdef solaris
- memcpy(&r, 0, sizeof(struct rusage));
+#ifdef sun
+ memset(&r, 0, sizeof(struct rusage));
#endif
getrusage(RUSAGE_SELF, &r);
track->user_start = r.ru_utime;