Fix gcc -Wall nitpicks

diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog
index fed2958..ae475fd 100644
--- a/debugfs/ChangeLog
+++ b/debugfs/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-07  Theodore Ts'o  <tytso@mit.edu>
+
+	* debugfs.c, debugfs.h, dump.c, htree.c, icheck.c, logdump.c,
+		ls.c, lsdel.c, ncheck.c, setsuper.c, unused.c: Fix gcc
+		-Wall nitpicks.
+
 2003-08-24  Theodore Ts'o  <tytso@mit.edu>
 
 	* debugfs.8.in: Adjust description line so that apropos
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 1fcb9d3..2c13e4f 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -229,7 +229,7 @@
 
 void do_show_super_stats(int argc, char *argv[])
 {
-	int	i;
+	dgrp_t	i;
 	FILE 	*out;
 	struct ext2_group_desc *gdp;
 	int	c, header_only = 0;
@@ -285,7 +285,8 @@
 	close_pager(out);
 }
 
-void do_dirty_filesys(int argc, char **argv)
+void do_dirty_filesys(int argc EXT2FS_ATTR((unused)), 
+		      char **argv EXT2FS_ATTR((unused)))
 {
 	if (check_fs_open(argv[0]))
 		return;
@@ -323,9 +324,11 @@
 	lb->first_block = 0;
 }
 
-static int list_blocks_proc(ext2_filsys fs, blk_t *blocknr,
-			    e2_blkcnt_t blockcnt, blk_t ref_block,
-			    int ref_offset, void *private)
+static int list_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)), 
+			    blk_t *blocknr, e2_blkcnt_t blockcnt, 
+			    blk_t ref_block EXT2FS_ATTR((unused)),
+			    int ref_offset EXT2FS_ATTR((unused)), 
+			    void *private)
 {
 	struct list_blocks_struct *lb = (struct list_blocks_struct *) private;
 
@@ -857,7 +860,8 @@
 }
 
 static int mark_blocks_proc(ext2_filsys fs, blk_t *blocknr,
-			    int blockcnt, void *private)
+			    int blockcnt EXT2FS_ATTR((unused)), 
+			    void *private EXT2FS_ATTR((unused)))
 {
 	blk_t	block;
 
@@ -1131,11 +1135,11 @@
 
 void do_mknod(int argc, char *argv[])
 {
-	unsigned long	mode, major, minor, nr;
+	unsigned long	mode, major, minor;
 	ext2_ino_t	newfile;
 	errcode_t 	retval;
 	struct ext2_inode inode;
-	int		filetype;
+	int		filetype, nr;
 
 	if (check_fs_open(argv[0]))
 		return;
@@ -1243,7 +1247,8 @@
 }
 
 static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr,
-			       int blockcnt, void *private)
+			       int blockcnt EXT2FS_ATTR((unused)), 
+			       void *private EXT2FS_ATTR((unused)))
 {
 	blk_t	block;
 
@@ -1318,12 +1323,12 @@
 	int		empty;
 };
 
-static int rmdir_proc(ext2_ino_t dir,
-		      int	entry,
+static int rmdir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
+		      int	entry EXT2FS_ATTR((unused)),
 		      struct ext2_dir_entry *dirent,
-		      int	offset,
-		      int	blocksize,
-		      char	*buf,
+		      int	offset EXT2FS_ATTR((unused)),
+		      int	blocksize EXT2FS_ATTR((unused)),
+		      char	*buf EXT2FS_ATTR((unused)),
 		      void	*private)
 {
 	struct rd_struct *rds = (struct rd_struct *) private;
@@ -1397,7 +1402,8 @@
 	}
 }
 
-void do_show_debugfs_params(int argc, char *argv[])
+void do_show_debugfs_params(int argc EXT2FS_ATTR((unused)), 
+			    char *argv[] EXT2FS_ATTR((unused)))
 {
 	FILE *out = stdout;
 
@@ -1484,7 +1490,7 @@
 		EXT2_INODE_SIZE(current_fs->super);
 	block = offset >> EXT2_BLOCK_SIZE_BITS(current_fs->super);
 	if (!current_fs->group_desc[(unsigned)group].bg_inode_table) {
-		com_err(argv[0], 0, "Inode table for group %d is missing\n",
+		com_err(argv[0], 0, "Inode table for group %lu is missing\n",
 			group);
 		return;
 	}
diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h
index e8c77a8..cb6ba85 100644
--- a/debugfs/debugfs.h
+++ b/debugfs/debugfs.h
@@ -73,6 +73,9 @@
 /* set_super.c */
 extern void do_set_super(int argc, char **);
 
+/* unused.c */
+extern void do_dump_unused(int argc, char **argv);
+
 /* debugfs.c */
 extern void internal_dump_inode(FILE *, const char *, ext2_ino_t, 
 				struct ext2_inode *, int);
diff --git a/debugfs/dump.c b/debugfs/dump.c
index 0ea6e35..fbaf703 100644
--- a/debugfs/dump.c
+++ b/debugfs/dump.c
@@ -120,7 +120,7 @@
 		if (got == 0)
 			break;
 		nbytes = write(fd, buf, got);
-		if (nbytes != got)
+		if ((unsigned) nbytes != got)
 			com_err(cmdname, errno, "while writing file");
 	}
 	retval = ext2fs_file_close(e2_file);
@@ -287,8 +287,10 @@
 	free(fullname);
 }
 
-static int rdump_dirent(struct ext2_dir_entry *dirent, int offset,
-			 int blocksize, char *buf, void *private)
+static int rdump_dirent(struct ext2_dir_entry *dirent, 
+			int offset EXT2FS_ATTR((unused)),
+			int blocksize EXT2FS_ATTR((unused)),
+			char *buf EXT2FS_ATTR((unused)), void *private)
 {
 	char name[EXT2_NAME_LEN];
 	int thislen;
diff --git a/debugfs/htree.c b/debugfs/htree.c
index 7084243..7af3d1b 100644
--- a/debugfs/htree.c
+++ b/debugfs/htree.c
@@ -33,7 +33,8 @@
 {
 	errcode_t	errcode;
 	struct ext2_dir_entry *dirent;
-	int		thislen, col = 0, offset = 0;
+	int		thislen, col = 0;
+	unsigned int	offset = 0;
 	char		name[EXT2_NAME_LEN];
 	char		tmp[EXT2_NAME_LEN + 16];
 	blk_t		pblk;
@@ -341,13 +342,15 @@
 
 
 static int search_dir_block(ext2_filsys fs, blk_t *blocknr,
-			    e2_blkcnt_t blockcnt, blk_t ref_blk, 
-			    int ref_offset, void *priv_data)
+			    e2_blkcnt_t blockcnt, 
+			    blk_t ref_blk EXT2FS_ATTR((unused)),
+			    int ref_offset EXT2FS_ATTR((unused)),
+			    void *priv_data)
 {
 	struct process_block_struct *p;
 	struct ext2_dir_entry *dirent;
 	errcode_t	       	errcode;
-	int			offset = 0;
+	unsigned int		offset = 0;
 
 	if (blockcnt < 0)
 		return 0;
@@ -357,7 +360,7 @@
 	errcode = io_channel_read_blk(current_fs->io, *blocknr, 1, p->buf);
 	if (errcode) {
 		com_err("search_dir_block", errcode,
-			"while reading block %lu", *blocknr);
+			"while reading block %lu", (unsigned long) *blocknr);
 		return BLOCK_ABORT;
 	}
 
diff --git a/debugfs/icheck.c b/debugfs/icheck.c
index c08d558..6c4b0a1 100644
--- a/debugfs/icheck.c
+++ b/debugfs/icheck.c
@@ -30,11 +30,11 @@
 	ext2_ino_t		inode;
 };
 
-static int icheck_proc(ext2_filsys fs,
+static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
 		       blk_t	*block_nr,
-		       e2_blkcnt_t blockcnt,
-		       blk_t ref_block,
-		       int ref_offset,
+		       e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
+		       blk_t ref_block EXT2FS_ATTR((unused)),
+		       int ref_offset EXT2FS_ATTR((unused)),
 		       void *private)
 {
 	struct block_walk_struct *bw = (struct block_walk_struct *) private;
diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index fcc12f0..ab85ffe 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -36,6 +36,8 @@
 
 enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL};
 
+#define ANY_BLOCK ((unsigned int) -1)
+
 int		dump_all, dump_contents, dump_descriptors;
 unsigned int	block_to_dump, group_to_dump, bitmap_to_dump;
 unsigned int	inode_block_to_dump, inode_offset_to_dump, bitmap_to_dump;
@@ -96,9 +98,9 @@
 	dump_all = 0;
 	dump_contents = 0;
 	dump_descriptors = 1;
-	block_to_dump = -1;
+	block_to_dump = ANY_BLOCK;
 	bitmap_to_dump = -1;
-	inode_block_to_dump = -1;
+	inode_block_to_dump = ANY_BLOCK;
 	inode_to_dump = -1;
 	
 	reset_getopt();
@@ -181,7 +183,7 @@
 		}
 	}
 
-	if (block_to_dump != -1 && current_fs != NULL) {
+	if (block_to_dump != ANY_BLOCK && current_fs != NULL) {
 		group_to_dump = ((block_to_dump - 
 				  es->s_first_data_block)
 				 / es->s_blocks_per_group);
@@ -299,7 +301,7 @@
 	
 	if (retval)
 		com_err(cmd, retval, "while while reading journal");
-	else if (*got != size) {
+	else if (*got != (unsigned int) size) {
 		com_err(cmd, 0, "short read (read %d, expected %d) while while reading journal", *got, size);
 		retval = -1;
 	}
@@ -332,7 +334,7 @@
 	char			jsb_buffer[1024];
 	char			buf[8192];
 	journal_superblock_t	*jsb;
-	int			blocksize = 1024;
+	unsigned int		blocksize = 1024;
 	unsigned int		got;
 	int			retval;
 	__u32			magic, sequence, blocktype;
@@ -513,9 +515,10 @@
 
 
 static void dump_revoke_block(FILE *out_file, char *buf,
-				  journal_superblock_t *jsb, 
-				  unsigned int blocknr, int blocksize,
-				  tid_t transaction)
+			      journal_superblock_t *jsb EXT2FS_ATTR((unused)), 
+			      unsigned int blocknr, 
+			      int blocksize EXT2FS_ATTR((unused)),
+			      tid_t transaction)
 {
 	int			offset, max;
 	journal_revoke_header_t *header;
@@ -561,7 +564,7 @@
 
 
 static void dump_metadata_block(FILE *out_file, struct journal_source *source,
-				journal_superblock_t *jsb,
+				journal_superblock_t *jsb EXT2FS_ATTR((unused)),
 				unsigned int log_blocknr, 
 				unsigned int fs_blocknr, 
 				int blocksize,
diff --git a/debugfs/ls.c b/debugfs/ls.c
index 2c672fb..72874eb 100644
--- a/debugfs/ls.c
+++ b/debugfs/ls.c
@@ -40,12 +40,12 @@
 static const char *monstr[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
 				"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
 					
-static int list_dir_proc(ext2_ino_t dir,
+static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
 			 int	entry,
 			 struct ext2_dir_entry *dirent,
-			 int	offset,
-			 int	blocksize,
-			 char	*buf,
+			 int	offset EXT2FS_ATTR((unused)),
+			 int	blocksize EXT2FS_ATTR((unused)),
+			 char	*buf EXT2FS_ATTR((unused)),
 			 void	*private)
 {
 	struct ext2_inode	inode;
diff --git a/debugfs/lsdel.c b/debugfs/lsdel.c
index 9a57a41..71febd5 100644
--- a/debugfs/lsdel.c
+++ b/debugfs/lsdel.c
@@ -49,7 +49,7 @@
 
 static int lsdel_proc(ext2_filsys fs,
 		      blk_t	*block_nr,
-		      int blockcnt,
+		      int blockcnt EXT2FS_ATTR((unused)),
 		      void *private)
 {
 	struct lsdel_struct *lsd = (struct lsdel_struct *) private;
@@ -128,7 +128,7 @@
 	
 	while (ino) {
 		if ((inode.i_dtime == 0) ||
-		    (secs && ((now - secs) > inode.i_dtime)))
+		    (secs && ((unsigned) abs(now - secs) > inode.i_dtime)))
 			goto next;
 
 		lsd.inode = ino;
diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c
index 2c2845c..bb7f524 100644
--- a/debugfs/ncheck.c
+++ b/debugfs/ncheck.c
@@ -33,9 +33,9 @@
 };
 
 static int ncheck_proc(struct ext2_dir_entry *dirent,
-		       int	offset,
-		       int	blocksize,
-		       char	*buf,
+		       int	offset EXT2FS_ATTR((unused)),
+		       int	blocksize EXT2FS_ATTR((unused)),
+		       char	*buf EXT2FS_ATTR((unused)),
 		       void	*private)
 {
 	struct inode_walk_struct *iw = (struct inode_walk_struct *) private;
diff --git a/debugfs/setsuper.c b/debugfs/setsuper.c
index b1061b2..1ff32e3 100644
--- a/debugfs/setsuper.c
+++ b/debugfs/setsuper.c
@@ -25,7 +25,7 @@
 struct super_set_info {
 	const char	*name;
 	void	*ptr;
-	int	size;
+	unsigned int	size;
 	errcode_t (*func)(struct super_set_info *info, char *arg);
 };
 
diff --git a/debugfs/unused.c b/debugfs/unused.c
index c055db7..d0a5162 100644
--- a/debugfs/unused.c
+++ b/debugfs/unused.c
@@ -24,11 +24,11 @@
 
 #include "debugfs.h"
 
-void do_dump_unused(int argc, char **argv)
+void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv)
 {
 	unsigned long	blk;
 	unsigned char buf[32768];
-	int	i;
+	unsigned int	i;
 	errcode_t	retval;
 
 	for (blk=current_fs->super->s_first_data_block;
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index b97949c..4b92c1b 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,5 +1,10 @@
 2003-12-07  Theodore Ts'o  <tytso@mit.edu>
 
+	* badblocks.c, dict.c, ea_refcount.c, ehandler.c, journal.c,
+		pass1.c, pass1b.c, pass2.c, pass3.c, pass5.c, problem.c,
+		rehash.c, super.c, swapfs.c, unix.c, util.c, e2fsck.h: Fix
+		gcc -Wall nitpicks.
+
 	* recovery.c, jfs_user.h: Sync recovery.c with latest 2.5 kernel
 		version.
 
diff --git a/e2fsck/badblocks.c b/e2fsck/badblocks.c
index 572af20..09ef3ab 100644
--- a/e2fsck/badblocks.c
+++ b/e2fsck/badblocks.c
@@ -17,7 +17,7 @@
 				 void *priv_data);
 
 
-static void invalid_block(ext2_filsys fs, blk_t blk)
+static void invalid_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t blk)
 {
 	printf(_("Bad block %u out of range; ignored.\n"), blk);
 	return;
@@ -113,8 +113,10 @@
 	
 }
 
-static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt,
-				 void *priv_data)
+static int check_bb_inode_blocks(ext2_filsys fs, 
+				 blk_t *block_nr, 
+				 int blockcnt EXT2FS_ATTR((unused)),
+				 void *priv_data EXT2FS_ATTR((unused)))
 {
 	if (!*block_nr)
 		return 0;
diff --git a/e2fsck/dict.c b/e2fsck/dict.c
index 350ce75..bccab8b 100644
--- a/e2fsck/dict.c
+++ b/e2fsck/dict.c
@@ -20,6 +20,12 @@
 
 #define NDEBUG
 
+#ifdef __GNUC__
+#define EXT2FS_ATTR(x) __attribute__(x)
+#else
+#define EXT2FS_ATTR(x)
+#endif
+
 #include <stdlib.h>
 #include <stddef.h>
 #include <assert.h>
@@ -963,12 +969,12 @@
     return verify_dict_has_node(dict_nil(dict), dict_root(dict), node);
 }
 
-static dnode_t *dnode_alloc(void *context)
+static dnode_t *dnode_alloc(void *context EXT2FS_ATTR((unused)))
 {
     return malloc(sizeof *dnode_alloc(NULL));
 }
 
-static void dnode_free(dnode_t *node, void *context)
+static void dnode_free(dnode_t *node, void *context EXT2FS_ATTR((unused)))
 {
     free(node);
 }
diff --git a/e2fsck/ea_refcount.c b/e2fsck/ea_refcount.c
index de13316..6420c72 100644
--- a/e2fsck/ea_refcount.c
+++ b/e2fsck/ea_refcount.c
@@ -28,7 +28,7 @@
 struct ea_refcount {
 	blk_t		count;
 	blk_t		size;
-	int		cursor;
+	blk_t		cursor;
 	struct ea_refcount_el	*list;
 };
 
@@ -83,7 +83,7 @@
  */
 static void refcount_collapse(ext2_refcount_t refcount)
 {
-	int	i, j;
+	unsigned int	i, j;
 	struct ea_refcount_el	*list;
 
 	list = refcount->list;
diff --git a/e2fsck/ehandler.c b/e2fsck/ehandler.c
index d4060c4..16d6d4f 100644
--- a/e2fsck/ehandler.c
+++ b/e2fsck/ehandler.c
@@ -23,8 +23,8 @@
 					  unsigned long block,
 					  int count,
 					  void *data,
-					  size_t size,
-					  int actual,
+					  size_t size EXT2FS_ATTR((unused)),
+					  int actual EXT2FS_ATTR((unused)),
 					  errcode_t error)
 {
 	int	i;
@@ -69,8 +69,8 @@
 					    unsigned long block,
 					    int count,
 					    const void *data,
-					    size_t size,
-					    int actual,
+					    size_t size EXT2FS_ATTR((unused)),
+					    int actual EXT2FS_ATTR((unused)),
 					    errcode_t error)
 {
 	int		i;
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 615bd3e..c645f3b 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -101,8 +101,8 @@
 						     1, bh->b_data);
 			if (retval) {
 				com_err(bh->b_ctx->device_name, retval,
-					"while reading block %ld\n", 
-					bh->b_blocknr);
+					"while reading block %lu\n", 
+					(unsigned long) bh->b_blocknr);
 				bh->b_err = retval;
 				continue;
 			}
@@ -115,8 +115,8 @@
 						      1, bh->b_data);
 			if (retval) {
 				com_err(bh->b_ctx->device_name, retval,
-					"while writing block %ld\n", 
-					bh->b_blocknr);
+					"while writing block %lu\n", 
+					(unsigned long) bh->b_blocknr);
 				bh->b_err = retval;
 				continue;
 			}
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 58edd0a..2062807 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -113,7 +113,7 @@
  * Free all memory allocated by pass1 in preparation for restarting
  * things.
  */
-static void unwind_pass1(ext2_filsys fs)
+static void unwind_pass1(ext2_filsys fs EXT2FS_ATTR((unused)))
 {
 	ext2fs_free_mem(&inodes_to_process);
 	inodes_to_process = 0;
@@ -165,7 +165,7 @@
 int e2fsck_pass1_check_symlink(ext2_filsys fs, struct ext2_inode *inode,
 			       char *buf)
 {
-	int len;
+	unsigned int len;
 	int i;
 	blk_t	blocks;
 
@@ -757,7 +757,8 @@
  * When the inode_scan routines call this callback at the end of the
  * glock group, call process_inodes.
  */
-static errcode_t scan_callback(ext2_filsys fs, ext2_inode_scan scan,
+static errcode_t scan_callback(ext2_filsys fs, 
+			       ext2_inode_scan scan EXT2FS_ATTR((unused)),
 			       dgrp_t group, void * priv_data)
 {
 	struct scan_callback_struct *scan_struct;
@@ -1144,7 +1145,8 @@
 
 /* Returns 1 if bad htree, 0 if OK */
 static int handle_htree(e2fsck_t ctx, struct problem_context *pctx,
-			ext2_ino_t ino, struct ext2_inode *inode,
+			ext2_ino_t ino EXT2FS_ATTR((unused)),
+			struct ext2_inode *inode,
 			char *block_buf)
 {
 	struct ext2_dx_root_info	*root;
@@ -1320,7 +1322,7 @@
 	} else {
 		size = EXT2_I_SIZE(inode);
 		if ((pb.last_block >= 0) &&
-		    (size < pb.last_block * fs->blocksize))
+		    (size < (__u64) pb.last_block * fs->blocksize))
 			bad_size = 3;
 		else if (size > ext2_max_sizes[fs->super->s_log_block_size])
 			bad_size = 4;
@@ -1410,8 +1412,8 @@
 static int process_block(ext2_filsys fs,
 		  blk_t	*block_nr,
 		  e2_blkcnt_t blockcnt,
-		  blk_t ref_block,
-		  int ref_offset, 
+		  blk_t ref_block EXT2FS_ATTR((unused)),
+		  int ref_offset EXT2FS_ATTR((unused)),
 		  void *priv_data)
 {
 	struct process_block_struct *p;
@@ -1545,14 +1547,14 @@
 static int process_bad_block(ext2_filsys fs,
 		      blk_t *block_nr,
 		      e2_blkcnt_t blockcnt,
-		      blk_t ref_block,
-		      int ref_offset,
+		      blk_t ref_block EXT2FS_ATTR((unused)),
+		      int ref_offset EXT2FS_ATTR((unused)),
 		      void *priv_data)
 {
 	struct process_block_struct *p;
 	blk_t		blk = *block_nr;
-	int		first_block;
-	int		i;
+	blk_t		first_block;
+	dgrp_t		i;
 	struct problem_context *pctx;
 	e2fsck_t	ctx;
 
@@ -1772,7 +1774,7 @@
 static void handle_fs_bad_blocks(e2fsck_t ctx)
 {
 	ext2_filsys fs = ctx->fs;
-	int		i;
+	dgrp_t		i;
 	int		first_block = fs->super->s_first_data_block;
 
 	for (i = 0; i < fs->group_desc_count; i++) {
@@ -1803,7 +1805,8 @@
 {
 	ext2_filsys fs = ctx->fs;
 	blk_t	block, b;
-	int	i, j;
+	dgrp_t	i;
+	int	j;
 	struct problem_context pctx;
 	
 	clear_problem_context(&pctx);
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index 39e9030..f368d84 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -159,7 +159,8 @@
 /*
  * Free a duplicate inode record
  */
-static void inode_dnode_free(dnode_t *node, void *context)
+static void inode_dnode_free(dnode_t *node, 
+			     void *context EXT2FS_ATTR((unused)))
 {
 	struct dup_inode	*di;
 	struct block_el		*p, *next;
@@ -175,7 +176,8 @@
 /*
  * Free a duplicate block record
  */
-static void block_dnode_free(dnode_t *node, void *context)
+static void block_dnode_free(dnode_t *node, 
+			     void *context EXT2FS_ATTR((unused)))
 {
 	struct dup_block	*db;
 	struct inode_el		*p, *next;
@@ -298,11 +300,11 @@
 	e2fsck_use_inode_shortcuts(ctx, 0);
 }
 
-static int process_pass1b_block(ext2_filsys fs,
+static int process_pass1b_block(ext2_filsys fs EXT2FS_ATTR((unused)),
 				blk_t	*block_nr,
-				e2_blkcnt_t blockcnt,
-				blk_t ref_blk, 
-				int ref_offset, 			 
+				e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
+				blk_t ref_blk EXT2FS_ATTR((unused)), 
+				int ref_offset EXT2FS_ATTR((unused)),
 				void *priv_data)
 {
 	struct process_block_struct *p;
@@ -342,8 +344,10 @@
 
 static int search_dirent_proc(ext2_ino_t dir, int entry,
 			      struct ext2_dir_entry *dirent,
-			      int offset, int blocksize,
-			      char *buf, void *priv_data)
+			      int offset EXT2FS_ATTR((unused)), 
+			      int blocksize EXT2FS_ATTR((unused)),
+			      char *buf EXT2FS_ATTR((unused)), 
+			      void *priv_data)
 {
 	struct search_dir_struct *sd;
 	struct dup_inode	*p;
@@ -521,9 +525,9 @@
 
 static int delete_file_block(ext2_filsys fs,
 			     blk_t	*block_nr,
-			     e2_blkcnt_t blockcnt,
-			     blk_t ref_block,
-			     int ref_offset, 
+			     e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
+			     blk_t ref_block EXT2FS_ATTR((unused)),
+			     int ref_offset EXT2FS_ATTR((unused)),
 			     void *priv_data)
 {
 	struct process_block_struct *pb;
@@ -623,8 +627,8 @@
 static int clone_file_block(ext2_filsys fs,
 			    blk_t	*block_nr,
 			    e2_blkcnt_t blockcnt,
-			    blk_t ref_block,
-			    int ref_offset, 
+			    blk_t ref_block EXT2FS_ATTR((unused)),
+			    int ref_offset EXT2FS_ATTR((unused)),
 			    void *priv_data)
 {
 	struct dup_block *p;
@@ -769,7 +773,7 @@
 {
 	ext2_filsys fs = ctx->fs;
 	blk_t	block;
-	int	i;
+	dgrp_t	i;
 	
 	block = fs->super->s_first_data_block;
 	for (i = 0; i < fs->group_desc_count; i++) {
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 6f2ac93..dee2c19 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -96,7 +96,7 @@
 	struct check_dir_struct cd;
 	struct dx_dir_info	*dx_dir;
 	struct dx_dirblock_info	*dx_db, *dx_parent;
-	blk_t			b;
+	int			b;
 	int			i, depth;
 	problem_t		code;
 	int			bad_dir;
@@ -459,7 +459,8 @@
  */
 static int check_name(e2fsck_t ctx,
 		      struct ext2_dir_entry *dirent,
-		      ext2_ino_t dir_ino, struct problem_context *pctx)
+		      ext2_ino_t dir_ino EXT2FS_ATTR((unused)), 
+		      struct problem_context *pctx)
 {
 	int	i;
 	int	fixup = -1;
@@ -483,8 +484,9 @@
  * Check the directory filetype (if present)
  */
 static _INLINE_ int check_filetype(e2fsck_t ctx,
-		      struct ext2_dir_entry *dirent,
-		      ext2_ino_t dir_ino, struct problem_context *pctx)
+				   struct ext2_dir_entry *dirent,
+				   ext2_ino_t dir_ino EXT2FS_ATTR((unused)),
+				   struct problem_context *pctx)
 {
 	int	filetype = dirent->name_len >> 8;
 	int	should_be = EXT2_FT_UNKNOWN;
@@ -591,7 +593,7 @@
 #endif
 		blk = ext2fs_le32_to_cpu(ent[i].block) & 0x0ffffff;
 		/* Check to make sure the block is valid */
-		if (blk > dx_dir->numblocks) {
+		if (blk > (blk_t) dx_dir->numblocks) {
 			cd->pctx.blk = blk;
 			if (fix_problem(cd->ctx, PR_2_HTREE_BADBLK,
 					&cd->pctx))
@@ -644,7 +646,7 @@
 static void salvage_directory(ext2_filsys fs,
 			      struct ext2_dir_entry *dirent,
 			      struct ext2_dir_entry *prev,
-			      int *offset)
+			      unsigned int *offset)
 {
 	char	*cp = (char *) dirent;
 	int left = fs->blocksize - *offset - dirent->rec_len;
@@ -708,7 +710,7 @@
 #endif /* ENABLE_HTREE */
 	struct ext2_dir_entry 	*dirent, *prev;
 	ext2_dirhash_t		hash;
-	int			offset = 0;
+	unsigned int		offset = 0;
 	int			dir_modified = 0;
 	int			dot_state;
 	blk_t			block_nr = db->blk;
@@ -1071,9 +1073,9 @@
  */
 static int deallocate_inode_block(ext2_filsys fs,
 				  blk_t	*block_nr,
-				  e2_blkcnt_t blockcnt,
-				  blk_t ref_block,
-				  int ref_offset, 
+				  e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
+				  blk_t ref_block EXT2FS_ATTR((unused)),
+				  int ref_offset EXT2FS_ATTR((unused)),
 				  void *priv_data)
 {
 	e2fsck_t	ctx = (e2fsck_t) priv_data;
@@ -1287,7 +1289,8 @@
  */
 static int allocate_dir_block(e2fsck_t ctx,
 			      struct ext2_db_entry *db,
-			      char *buf, struct problem_context *pctx)
+			      char *buf EXT2FS_ATTR((unused)), 
+			      struct problem_context *pctx)
 {
 	ext2_filsys fs = ctx->fs;
 	blk_t			blk;
@@ -1366,11 +1369,11 @@
 /*
  * This is a helper function for allocate_dir_block().
  */
-static int update_dir_block(ext2_filsys fs,
+static int update_dir_block(ext2_filsys fs EXT2FS_ATTR((unused)),
 			    blk_t	*block_nr,
 			    e2_blkcnt_t blockcnt,
-			    blk_t ref_block,
-			    int ref_offset, 
+			    blk_t ref_block EXT2FS_ATTR((unused)),
+			    int ref_offset EXT2FS_ATTR((unused)), 
 			    void *priv_data)
 {
 	struct ext2_db_entry *db;
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index bafcb4c..e2bdd54 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -611,9 +611,9 @@
 };
 
 static int fix_dotdot_proc(struct ext2_dir_entry *dirent,
-			   int	offset,
-			   int	blocksize,
-			   char	*buf,
+			   int	offset EXT2FS_ATTR((unused)),
+			   int	blocksize EXT2FS_ATTR((unused)),
+			   char	*buf EXT2FS_ATTR((unused)),
 			   void	*priv_data)
 {
 	struct fix_dotdot_struct *fp = (struct fix_dotdot_struct *) priv_data;
@@ -691,8 +691,8 @@
 static int expand_dir_proc(ext2_filsys fs,
 			   blk_t	*blocknr,
 			   e2_blkcnt_t	blockcnt,
-			   blk_t ref_block,
-			   int ref_offset, 
+			   blk_t ref_block EXT2FS_ATTR((unused)),
+			   int ref_offset EXT2FS_ATTR((unused)),
 			   void	*priv_data)
 {
 	struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index 862b7e0..e708fa4 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -114,8 +114,8 @@
 	blk_t	i;
 	int	*free_array;
 	int	group = 0;
-	int	blocks = 0;
-	int	free_blocks = 0;
+	unsigned int	blocks = 0;
+	unsigned int	free_blocks = 0;
 	int	group_free = 0;
 	int	actual, bitmap;
 	struct problem_context	pctx;
@@ -275,17 +275,17 @@
 {
 	ext2_filsys fs = ctx->fs;
 	ext2_ino_t	i;
-	int	free_inodes = 0;
-	int	group_free = 0;
-	int	dirs_count = 0;
-	int	group = 0;
-	int	inodes = 0;
-	int	*free_array;
-	int	*dir_array;
-	int	actual, bitmap;
+	unsigned int	free_inodes = 0;
+	int		group_free = 0;
+	int		dirs_count = 0;
+	int		group = 0;
+	unsigned int	inodes = 0;
+	int		*free_array;
+	int		*dir_array;
+	int		actual, bitmap;
 	errcode_t	retval;
 	struct problem_context	pctx;
-	int	problem, save_problem, fixit, had_problem;
+	int		problem, save_problem, fixit, had_problem;
 	
 	clear_problem_context(&pctx);
 	free_array = (int *) e2fsck_allocate_memory(ctx,
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index a164bb5..9f0b561 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1440,7 +1440,7 @@
 	{ -1, 0, 0 },
 };
 
-static const struct e2fsck_problem *find_problem(int code)
+static const struct e2fsck_problem *find_problem(problem_t code)
 {
 	int 	i;
 
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index c6b0b02..727e08c 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -79,15 +79,15 @@
 static int fill_dir_block(ext2_filsys fs,
 			  blk_t	*block_nr,
 			  e2_blkcnt_t blockcnt,
-			  blk_t ref_block,
-			  int ref_offset, 
+			  blk_t ref_block EXT2FS_ATTR((unused)),
+			  int ref_offset EXT2FS_ATTR((unused)),
 			  void *priv_data)
 {
 	struct fill_dir_struct	*fd = (struct fill_dir_struct *) priv_data;
 	struct hash_entry 	*new_array, *ent;
 	struct ext2_dir_entry 	*dirent;
 	char			*dir;
-	int			offset, dir_offset;
+	unsigned int		offset, dir_offset;
 	
 	if (blockcnt < 0)
 		return 0;
@@ -589,8 +589,8 @@
 static int write_dir_block(ext2_filsys fs,
 			   blk_t	*block_nr,
 			   e2_blkcnt_t blockcnt,
-			   blk_t ref_block,
-			   int ref_offset, 
+			   blk_t ref_block EXT2FS_ATTR((unused)),
+			   int ref_offset EXT2FS_ATTR((unused)), 
 			   void *priv_data)
 {
 	struct write_dir_struct	*wd = (struct write_dir_struct *) priv_data;
diff --git a/e2fsck/super.c b/e2fsck/super.c
index b6c5e74..9a1ab4c 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -60,7 +60,7 @@
 	struct problem_context *pctx;
 	int		truncating;
 	int		truncate_offset;
-	blk_t		truncate_block;
+	e2_blkcnt_t	truncate_block;
 	int		truncated_blocks;
 	int		abort;
 	errcode_t	errcode;
@@ -68,7 +68,9 @@
 
 static int release_inode_block(ext2_filsys fs,
 			       blk_t	*block_nr,
-			       int blockcnt,
+			       e2_blkcnt_t blockcnt,
+			       blk_t	ref_blk EXT2FS_ATTR((unused)),
+			       int	ref_offset EXT2FS_ATTR((unused)),
 			       void *priv_data)
 {
 	struct process_block_struct *pb;
@@ -180,7 +182,7 @@
 	pb.pctx = pctx;
 	if (inode->i_links_count) {
 		pb.truncating = 1;
-		pb.truncate_block = (blk_t)
+		pb.truncate_block = (e2_blkcnt_t)
 			((((long long)inode->i_size_high << 32) +
 			  inode->i_size + fs->blocksize - 1) /
 			 fs->blocksize);
@@ -191,7 +193,7 @@
 		pb.truncate_offset = 0;
 	}
 	pb.truncated_blocks = 0;
-	retval = ext2fs_block_iterate(fs, ino, BLOCK_FLAG_DEPTH_TRAVERSE, 
+	retval = ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_DEPTH_TRAVERSE, 
 				      block_buf, release_inode_block, &pb);
 	if (retval) {
 		com_err("release_inode_blocks", retval,
@@ -384,7 +386,7 @@
 		}
 	}
 
-	if (sb->s_log_block_size != sb->s_log_frag_size) {
+	if (sb->s_log_block_size != (__u32) sb->s_log_frag_size) {
 		pctx.blk = EXT2_BLOCK_SIZE(sb);
 		pctx.blk2 = EXT2_FRAG_SIZE(sb);
 		fix_problem(ctx, PR_0_NO_FRAGMENTS, &pctx);
diff --git a/e2fsck/swapfs.c b/e2fsck/swapfs.c
index 8e9a134..3e7609b 100644
--- a/e2fsck/swapfs.c
+++ b/e2fsck/swapfs.c
@@ -110,7 +110,8 @@
 static void swap_inodes(e2fsck_t ctx)
 {
 	ext2_filsys fs = ctx->fs;
-	int			i, group;
+	dgrp_t			group;
+	unsigned int		i;
 	ext2_ino_t		ino = 1;
 	char 			*buf, *block_buf;
 	errcode_t		retval;
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 91511bf..4c2598f 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -199,7 +199,7 @@
 	return;
 }
 
-static int is_on_batt()
+static int is_on_batt(void)
 {
 	FILE	*f;
 	char	tmp[80], tmp2[80];
@@ -254,12 +254,12 @@
 			     (unsigned) fs->super->s_max_mnt_count*2))
 			reason = 0;
 	} else if (fs->super->s_checkinterval &&
-		 now >= (fs->super->s_lastcheck +
-			     fs->super->s_checkinterval)) {
+		   ((now - fs->super->s_lastcheck) >= 
+		    fs->super->s_checkinterval)) {
 		reason = _(" has gone %u days without being checked");
 		reason_arg = (now - fs->super->s_lastcheck)/(3600*24);
-		if (batt && (now < (fs->super->s_lastcheck +
-				    fs->super->s_checkinterval*2)))
+		if (batt && ((now - fs->super->s_lastcheck) < 
+			     fs->super->s_checkinterval*2))
 			reason = 0;
 	}
 	if (reason) {
@@ -279,13 +279,13 @@
 		if (next_check <= 0) 
 			next_check = 1;
 	}
-	if (now >= (fs->super->s_lastcheck + fs->super->s_checkinterval))
+	if ((now - fs->super->s_lastcheck) >= fs->super->s_checkinterval)
 		next_check = 1;
 	if (next_check <= 5) {
 		if (next_check == 1)
 			fputs(_(" (check after next mount)"), stdout);
 		else
-			printf(_(" (check in %d mounts)"), next_check);
+			printf(_(" (check in %ld mounts)"), next_check);
 	}
 	fputc('\n', stdout);
 	ext2fs_close(fs);
@@ -336,7 +336,7 @@
 {
 	static const char spinner[] = "\\|/-";
 	int	i;
-	int	tick;
+	unsigned int	tick;
 	struct timeval	tv;
 	int dpywidth;
 
@@ -437,7 +437,7 @@
 }
 
 #ifdef HAVE_SIGNAL_H
-static void signal_progress_on(int sig)
+static void signal_progress_on(int sig EXT2FS_ATTR((unused)))
 {
 	e2fsck_t ctx = e2fsck_global_ctx;
 
@@ -448,7 +448,7 @@
 	ctx->progress_fd = 0;
 }
 
-static void signal_progress_off(int sig)
+static void signal_progress_off(int sig EXT2FS_ATTR((unused)))
 {
 	e2fsck_t ctx = e2fsck_global_ctx;
 
@@ -459,7 +459,7 @@
 	ctx->progress = 0;
 }
 
-static void signal_cancel(int sig)
+static void signal_cancel(int sig EXT2FS_ATTR((unused)))
 {
 	e2fsck_t ctx = e2fsck_global_ctx;
 
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 8bb538d..569fc58 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -70,7 +70,8 @@
 	return ret;
 }
 
-char *string_copy(e2fsck_t ctx, const char *str, int len)
+char *string_copy(e2fsck_t ctx EXT2FS_ATTR((unused)), 
+		  const char *str, int len)
 {
 	char	*ret;
 	
diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog
index eebbf15..f6d3bb1 100644
--- a/lib/blkid/ChangeLog
+++ b/lib/blkid/ChangeLog
@@ -1,3 +1,7 @@
+2003-12-07  Theodore Ts'o  <tytso@mit.edu>
+
+	* probe.c, read.c, blkidP.h: Fix gcc -Wall nitpicks.
+
 2003-07-25  Theodore Ts'o  <tytso@mit.edu>
 
 	* Release of E2fsprogs 1.34
diff --git a/lib/blkid/blkidP.h b/lib/blkid/blkidP.h
index 1ab29c5..7d90b5e 100644
--- a/lib/blkid/blkidP.h
+++ b/lib/blkid/blkidP.h
@@ -20,6 +20,13 @@
 
 #include <blkid/list.h>
 
+#ifdef __GNUC__
+#define __BLKID_ATTR(x) __attribute__(x)
+#else
+#define __BLKID_ATTR(x)
+#endif
+
+
 /*
  * This describes the attributes of a specific device.
  * We can traverse all of the tags by bid_tags (linking to the tag bit_names).
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 505400c..5b74c31 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -78,7 +78,9 @@
 	}
 }
 
-static int probe_ext2(int fd, blkid_cache cache, blkid_dev dev,
+static int probe_ext2(int fd __BLKID_ATTR((unused)), 
+		      blkid_cache cache __BLKID_ATTR((unused)), 
+		      blkid_dev dev,
 		      struct blkid_magic *id, unsigned char *buf)
 {
 	struct ext2_super_block *es;
@@ -111,8 +113,11 @@
 	return 0;
 }
 
-static int probe_jbd(int fd, blkid_cache cache, blkid_dev dev, 
-		     struct blkid_magic *id, unsigned char *buf)
+static int probe_jbd(int fd __BLKID_ATTR((unused)), 
+		     blkid_cache cache __BLKID_ATTR((unused)), 
+		     blkid_dev dev, 
+		     struct blkid_magic *id __BLKID_ATTR((unused)), 
+		     unsigned char *buf)
 {
 	struct ext2_super_block *es = (struct ext2_super_block *) buf;
 
@@ -123,8 +128,11 @@
 	return (probe_ext2(fd, cache, dev, 0, buf));
 }
 
-static int probe_vfat(int fd, blkid_cache cache, blkid_dev dev,
-		      struct blkid_magic *id, unsigned char *buf)
+static int probe_vfat(int fd __BLKID_ATTR((unused)), 
+		      blkid_cache cache __BLKID_ATTR((unused)), 
+		      blkid_dev dev,
+		      struct blkid_magic *id __BLKID_ATTR((unused)), 
+		      unsigned char *buf)
 {
 	struct vfat_super_block *vs;
 	char serno[10];
@@ -150,8 +158,11 @@
 	return 0;
 }
 
-static int probe_msdos(int fd, blkid_cache cache, blkid_dev dev,
-		       struct blkid_magic *id, unsigned char *buf)
+static int probe_msdos(int fd __BLKID_ATTR((unused)), 
+		       blkid_cache cache __BLKID_ATTR((unused)), 
+		       blkid_dev dev,
+		       struct blkid_magic *id __BLKID_ATTR((unused)), 
+		       unsigned char *buf)
 {
 	struct msdos_super_block *ms = (struct msdos_super_block *) buf;
 	char serno[10];
@@ -175,8 +186,11 @@
 	return 0;
 }
 
-static int probe_xfs(int fd, blkid_cache cache, blkid_dev dev,
-		     struct blkid_magic *id, unsigned char *buf)
+static int probe_xfs(int fd __BLKID_ATTR((unused)), 
+		     blkid_cache cache __BLKID_ATTR((unused)), 
+		     blkid_dev dev,
+		     struct blkid_magic *id __BLKID_ATTR((unused)), 
+		     unsigned char *buf)
 {
 	struct xfs_super_block *xs;
 	const char *label = 0;
@@ -190,7 +204,9 @@
 	return 0;
 }
 
-static int probe_reiserfs(int fd, blkid_cache cache, blkid_dev dev,
+static int probe_reiserfs(int fd __BLKID_ATTR((unused)), 
+			  blkid_cache cache __BLKID_ATTR((unused)), 
+			  blkid_dev dev,
 			  struct blkid_magic *id, unsigned char *buf)
 {
 	struct reiserfs_super_block *rs = (struct reiserfs_super_block *) buf;
@@ -215,8 +231,11 @@
 	return 0;
 }
 
-static int probe_jfs(int fd, blkid_cache cache, blkid_dev dev,
-		     struct blkid_magic *id, unsigned char *buf)
+static int probe_jfs(int fd __BLKID_ATTR((unused)), 
+		     blkid_cache cache __BLKID_ATTR((unused)), 
+		     blkid_dev dev,
+		     struct blkid_magic *id __BLKID_ATTR((unused)), 
+		     unsigned char *buf)
 {
 	struct jfs_super_block *js;
 	const char *label = 0;
@@ -230,8 +249,11 @@
 	return 0;
 }
 
-static int probe_romfs(int fd, blkid_cache cache, blkid_dev dev,
-		       struct blkid_magic *id, unsigned char *buf)
+static int probe_romfs(int fd __BLKID_ATTR((unused)), 
+		       blkid_cache cache __BLKID_ATTR((unused)), 
+		       blkid_dev dev,
+		       struct blkid_magic *id __BLKID_ATTR((unused)), 
+		       unsigned char *buf)
 {
 	struct romfs_super_block *ros;
 	const char *label = 0;
@@ -244,16 +266,18 @@
 	return 0;
 }
 
-static char
+static const char
 *udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02",
 		 "NSR03", "TEA01", 0 };
 
-static int probe_udf(int fd, blkid_cache cache, blkid_dev dev,
-		       struct blkid_magic *id, unsigned char *buf)
+static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), 
+		     blkid_dev dev __BLKID_ATTR((unused)),
+		       struct blkid_magic *id __BLKID_ATTR((unused)), 
+		     unsigned char *buf __BLKID_ATTR((unused)))
 {
 	int j, bs;
 	struct iso_volume_descriptor isosb;
-	char **m;
+	const char ** m;
 
 	/* determine the block size by scanning in 2K increments
 	   (block sizes larger than 2K will be null padded) */
diff --git a/lib/blkid/read.c b/lib/blkid/read.c
index b07cf79..0a8e3f3 100644
--- a/lib/blkid/read.c
+++ b/lib/blkid/read.c
@@ -403,10 +403,12 @@
 
 	while (fgets(buf, sizeof(buf), file)) {
 		blkid_dev dev;
-
-		int end = strlen(buf) - 1;
+		unsigned int end;
 
 		lineno++;
+		if (buf[0] == 0)
+			continue;
+		end = strlen(buf) - 1;
 		/* Continue reading next line if it ends with a backslash */
 		while (buf[end] == '\\' && end < sizeof(buf) - 2 &&
 		       fgets(buf + end, sizeof(buf) - end, file)) {
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 377f594..586abc1 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,13 @@
+2003-12-02  Theodore Ts'o  <tytso@mit.edu>
+
+	* alloc.c, bb_inode.c, bitops.c, block.c, check_desc.c, closefs.c,
+		dir_iterate.c, dirblock.c, expanddir.c, ext2fs.h,
+		get_pathname.c, icount.c, imager.c, initalize.c, inode.c,
+		lookup.c, openfs.c, read_bb.c, read_bb_file.c,
+		rw_bitmaps.c, unix_io.c, unlink.c, write_bb_file.c: Fix
+		gcc -Wall complaints.  Mainly marking variables as being
+		unsued, and catching signed vs. unsigned comparisons.
+
 2003-09-03  Theodore Ts'o  <tytso@mit.edu>
 
 	* closefs.c (ext2fs_super_and_bgd_loc): New function which
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 3356006..7385123 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -32,7 +32,8 @@
  *
  * Should have a special policy for directories.
  */
-errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
+errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, 
+			   int mode EXT2FS_ATTR((unused)),
 			   ext2fs_inode_bitmap map, ext2_ino_t *ret)
 {
 	ext2_ino_t	dir_group = 0;
diff --git a/lib/ext2fs/bb_inode.c b/lib/ext2fs/bb_inode.c
index f601787..dd8e7c3 100644
--- a/lib/ext2fs/bb_inode.c
+++ b/lib/ext2fs/bb_inode.c
@@ -151,7 +151,8 @@
 #endif
 static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
 				e2_blkcnt_t blockcnt,
-				blk_t ref_block, int ref_offset,
+				blk_t ref_block EXT2FS_ATTR((unused)),
+				int ref_offset EXT2FS_ATTR((unused)),
 				void *priv_data)
 {
 	struct set_badblock_record *rec = (struct set_badblock_record *)
@@ -206,8 +207,10 @@
  #pragma argsused
 #endif
 static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
-			      e2_blkcnt_t blockcnt, blk_t ref_block, 
-			      int ref_offset, void *priv_data)
+			      e2_blkcnt_t blockcnt,
+			      blk_t ref_block EXT2FS_ATTR((unused)),
+			      int ref_offset EXT2FS_ATTR((unused)),
+			      void *priv_data)
 {
 	struct set_badblock_record *rec = (struct set_badblock_record *)
 		priv_data;
diff --git a/lib/ext2fs/bitops.c b/lib/ext2fs/bitops.c
index e27c5a0..886eb5e 100644
--- a/lib/ext2fs/bitops.c
+++ b/lib/ext2fs/bitops.c
@@ -71,9 +71,9 @@
 {
 #ifndef OMIT_COM_ERR
 	if (description)
-		com_err(0, errcode, "#%u for %s", arg, description);
+		com_err(0, errcode, "#%lu for %s", arg, description);
 	else
-		com_err(0, errcode, "#%u", arg);
+		com_err(0, errcode, "#%lu", arg);
 #endif
 }
 
@@ -83,9 +83,9 @@
 #ifndef OMIT_COM_ERR
 	if (bitmap->description)
 		com_err(0, bitmap->base_error_code+code,
-			"#%u for %s", arg, bitmap->description);
+			"#%lu for %s", arg, bitmap->description);
 	else
-		com_err(0, bitmap->base_error_code + code, "#%u", arg);
+		com_err(0, bitmap->base_error_code + code, "#%lu", arg);
 #endif
 }
 
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 338b918..f64c0af 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -467,7 +467,9 @@
  #pragma argsused
 #endif
 static int xlate_func(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
-		      blk_t ref_block, int ref_offset, void *priv_data)
+		      blk_t ref_block EXT2FS_ATTR((unused)),
+		      int ref_offset EXT2FS_ATTR((unused)),
+		      void *priv_data)
 {
 	struct xlate *xl = (struct xlate *) priv_data;
 
diff --git a/lib/ext2fs/check_desc.c b/lib/ext2fs/check_desc.c
index 902c4b6..2a754c7 100644
--- a/lib/ext2fs/check_desc.c
+++ b/lib/ext2fs/check_desc.c
@@ -31,7 +31,7 @@
  */
 errcode_t ext2fs_check_desc(ext2_filsys fs)
 {
-	int i;
+	dgrp_t i;
 	blk_t block = fs->super->s_first_data_block;
 	blk_t next;
 
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 56be292..1256385 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -53,7 +53,8 @@
 			     int *ret_meta_bg)
 {
 	blk_t	group_block, super_blk = 0, old_desc_blk = 0, new_desc_blk = 0;
-	int	numblocks, j, has_super, meta_bg_size, meta_bg;
+	unsigned int meta_bg, meta_bg_size;
+	int	numblocks, has_super;
 	int	old_desc_blocks;
 
 	group_block = fs->super->s_first_data_block +
diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
index 9a6ac91..003c0a3 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -96,7 +96,8 @@
 	void *real_private;
 };
 
-static int xlate_func(ext2_ino_t dir, int entry,
+static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)),
+		      int entry EXT2FS_ATTR((unused)),
 		      struct ext2_dir_entry *dirent, int offset,
 		      int blocksize, char *buf, void *priv_data)
 {
@@ -130,16 +131,16 @@
  * Helper function which is private to this module.  Used by
  * ext2fs_dir_iterate() and ext2fs_dblist_dir_iterate()
  */
-int ext2fs_process_dir_block(ext2_filsys  	fs,
-			     blk_t		*blocknr,
-			     e2_blkcnt_t		blockcnt,
-			     blk_t		ref_block,
-			     int			ref_offset,
-			     void		*priv_data)
+int ext2fs_process_dir_block(ext2_filsys fs,
+			     blk_t	*blocknr,
+			     e2_blkcnt_t blockcnt,
+			     blk_t	ref_block EXT2FS_ATTR((unused)),
+			     int	ref_offset EXT2FS_ATTR((unused)),
+			     void	*priv_data)
 {
 	struct dir_context *ctx = (struct dir_context *) priv_data;
-	int		offset = 0;
-	int		next_real_entry = 0;
+	unsigned int	offset = 0;
+	unsigned int	next_real_entry = 0;
 	int		ret = 0;
 	int		changed = 0;
 	int		do_abort = 0;
@@ -191,8 +192,9 @@
 			size = ((dirent->name_len & 0xFF) + 11) & ~3;
 
 			if (dirent->rec_len != size)  {
-				int final_offset = offset + dirent->rec_len;
- 			
+				unsigned int final_offset;
+
+				final_offset = offset + dirent->rec_len;
 				offset += size;
 				while (offset < final_offset &&
 				       !ext2fs_validate_entry(ctx->buf,
diff --git a/lib/ext2fs/dirblock.c b/lib/ext2fs/dirblock.c
index 0cb07c7..ebfc72c 100644
--- a/lib/ext2fs/dirblock.c
+++ b/lib/ext2fs/dirblock.c
@@ -20,7 +20,7 @@
 #include "ext2fs.h"
 
 errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
-				 void *buf, int flags)
+				 void *buf, int flags EXT2FS_ATTR((unused)))
 {
 	errcode_t	retval;
 	char		*p, *end;
@@ -71,7 +71,7 @@
 
 
 errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
-				  void *inbuf, int flags)
+				  void *inbuf, int flags EXT2FS_ATTR((unused)))
 {
 #ifdef EXT2FS_ENABLE_SWAPFS
 	int		do_swap = 0;
diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c
index 3c2c803..10a5149 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -24,12 +24,12 @@
 	errcode_t	err;
 };
 
-static int expand_dir_proc(ext2_filsys		fs,
-			   blk_t		*blocknr,
-			   e2_blkcnt_t		blockcnt,
-			   blk_t		ref_block,
-			   int			ref_offset,
-			   void			*priv_data)
+static int expand_dir_proc(ext2_filsys	fs,
+			   blk_t	*blocknr,
+			   e2_blkcnt_t	blockcnt,
+			   blk_t	ref_block EXT2FS_ATTR((unused)),
+			   int		ref_offset EXT2FS_ATTR((unused)),
+			   void		*priv_data)
 {
 	struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
 	blk_t	new_blk;
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index d0bd280..92f273e 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -12,6 +12,12 @@
 #ifndef _EXT2FS_EXT2FS_H
 #define _EXT2FS_EXT2FS_H
 
+#ifdef __GNUC__
+#define EXT2FS_ATTR(x) __attribute__(x)
+#else
+#define EXT2FS_ATTR(x)
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -201,7 +207,7 @@
 	int				flags;
 	char *				device_name;
 	struct ext2_super_block	* 	super;
-	int				blocksize;
+	unsigned int			blocksize;
 	int				fragsize;
 	dgrp_t				group_desc_count;
 	unsigned long			desc_blocks;
@@ -482,6 +488,7 @@
 /* badblocks.c */
 extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size);
 extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk);
+extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk);
 extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk);
 extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb,
 					       ext2_u32_iterate *ret);
@@ -754,9 +761,11 @@
 
 /* icount.c */
 extern void ext2fs_free_icount(ext2_icount_t icount);
-extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, int size,
+extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, 
+				       unsigned int size,
 				       ext2_icount_t hint, ext2_icount_t *ret);
-extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, int size,
+extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, 
+				      unsigned int size,
 				      ext2_icount_t *ret);
 extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
 				     __u16 *ret);
@@ -839,7 +848,7 @@
 
 /* openfs.c */
 extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
-			     int block_size, io_manager manager,
+			     unsigned int block_size, io_manager manager,
 			     ext2_filsys *ret_fs);
 extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, 
 					 dgrp_t i);
@@ -968,7 +977,7 @@
 /*
  *  Resize memory
  */
-_INLINE_ errcode_t ext2fs_resize_mem(unsigned long old_size,
+_INLINE_ errcode_t ext2fs_resize_mem(unsigned long old_size EXT2FS_ATTR((unused)),
 				     unsigned long size, void *ptr)
 {
 	void *p;
diff --git a/lib/ext2fs/get_pathname.c b/lib/ext2fs/get_pathname.c
index a8449c6..23f593f 100644
--- a/lib/ext2fs/get_pathname.c
+++ b/lib/ext2fs/get_pathname.c
@@ -38,9 +38,9 @@
  #pragma argsused
 #endif
 static int get_pathname_proc(struct ext2_dir_entry *dirent,
-			     int	offset,
-			     int	blocksize,
-			     char	*buf,
+			     int	offset EXT2FS_ATTR((unused)),
+			     int	blocksize EXT2FS_ATTR((unused)),
+			     char	*buf EXT2FS_ATTR((unused)),
 			     void	*priv_data)
 {
 	struct get_pathname_struct	*gp;
diff --git a/lib/ext2fs/icount.c b/lib/ext2fs/icount.c
index e08b335..5997792 100644
--- a/lib/ext2fs/icount.c
+++ b/lib/ext2fs/icount.c
@@ -49,7 +49,7 @@
 	ext2_ino_t		count;
 	ext2_ino_t		size;
 	ext2_ino_t		num_inodes;
-	int			cursor;
+	ext2_ino_t		cursor;
 	struct ext2_icount_el	*list;
 };
 
@@ -68,13 +68,13 @@
 	ext2fs_free_mem(&icount);
 }
 
-errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, int size,
+errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size,
 				ext2_icount_t hint, ext2_icount_t *ret)
 {
 	ext2_icount_t	icount;
 	errcode_t	retval;
 	size_t		bytes;
-	int		i;
+	ext2_ino_t	i;
 
 	if (hint) {
 		EXT2_CHECK_MAGIC(hint, EXT2_ET_MAGIC_ICOUNT);
@@ -148,7 +148,8 @@
 	return(retval);
 }
 
-errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, int size,
+errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, 
+			       unsigned int size,
 			       ext2_icount_t *ret)
 {
 	return ext2fs_create_icount2(fs, flags, size, 0, ret);
@@ -273,7 +274,7 @@
 errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out)
 {
 	errcode_t	ret = 0;
-	int		i;
+	unsigned int	i;
 	const char *bad = "bad icount";
 	
 	EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c
index b72a9fb..596fbbe 100644
--- a/lib/ext2fs/imager.c
+++ b/lib/ext2fs/imager.c
@@ -108,7 +108,7 @@
 					retval = errno;
 					goto errout;
 				}
-				if (actual != fs->blocksize * d) {
+				if (actual != (ssize_t) (fs->blocksize * d)) {
 					retval = EXT2_ET_SHORT_WRITE;
 					goto errout;
 				}
@@ -129,7 +129,8 @@
 /*
  * Read in the inode table and stuff it into place
  */
-errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags)
+errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, 
+				  int flags EXT2FS_ATTR((unused)))
 {
 	unsigned int	group, c, left;
 	char		*buf;
@@ -157,7 +158,7 @@
 				retval = errno;
 				goto errout;
 			}
-			if (actual != fs->blocksize * c) {
+			if (actual != (ssize_t) (fs->blocksize * c)) {
 				retval = EXT2_ET_SHORT_READ;
 				goto errout;
 			}
@@ -179,7 +180,8 @@
 /*
  * Write out superblock and group descriptors
  */
-errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags)
+errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, 
+				   int flags EXT2FS_ATTR((unused)))
 {
 	char		*buf, *cp;
 	ssize_t		actual;
@@ -199,7 +201,7 @@
 		retval = errno;
 		goto errout;
 	}
-	if (actual != fs->blocksize) {
+	if (actual != (ssize_t) fs->blocksize) {
 		retval = EXT2_ET_SHORT_WRITE;
 		goto errout;
 	}
@@ -213,7 +215,7 @@
 		retval = errno;
 		goto errout;
 	}
-	if (actual != fs->blocksize * fs->desc_blocks) {
+	if (actual != (ssize_t) (fs->blocksize * fs->desc_blocks)) {
 		retval = EXT2_ET_SHORT_WRITE;
 		goto errout;
 	}
@@ -228,7 +230,8 @@
 /*
  * Read the superblock and group descriptors and overwrite them.
  */
-errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags)
+errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, 
+				  int flags EXT2FS_ATTR((unused)))
 {
 	char		*buf;
 	ssize_t		actual, size;
@@ -312,7 +315,7 @@
 		size = fs->blocksize - size;
 		while (size) {
 			c = size;
-			if (c > sizeof(zero_buf))
+			if (c > (int) sizeof(zero_buf))
 				c = sizeof(zero_buf);
 			actual = write(fd, zero_buf, c);
 			if (actual == -1) {
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index d1cb750..74f20a7 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -66,11 +66,11 @@
 	errcode_t	retval;
 	struct ext2_super_block *super;
 	int		frags_per_block;
-	int		rem;
-	int		overhead = 0;
+	unsigned int	rem;
+	unsigned int	overhead = 0;
 	blk_t		group_block;
-	int		ipg;
-	int		i, j;
+	unsigned int	ipg;
+	dgrp_t		i;
 	blk_t		numblocks;
 	char		*buf;
 
@@ -205,7 +205,7 @@
 			return EXT2_ET_TOO_MANY_INODES;
 	}
 
-	if (ipg > EXT2_MAX_INODES_PER_GROUP(super))
+	if (ipg > (unsigned) EXT2_MAX_INODES_PER_GROUP(super))
 		ipg = EXT2_MAX_INODES_PER_GROUP(super);
 
 	super->s_inodes_per_group = ipg;
@@ -262,8 +262,8 @@
 	 * necessary data structures.  If not, we need to get rid of
 	 * it.
 	 */
-	rem = (int) ((super->s_blocks_count - super->s_first_data_block) %
-		     super->s_blocks_per_group);
+	rem = ((super->s_blocks_count - super->s_first_data_block) %
+	       super->s_blocks_per_group);
 	if ((fs->group_desc_count == 1) && rem && (rem < overhead))
 		return EXT2_ET_TOOSMALL;
 	if (rem && (rem < overhead+50)) {
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index d80f6c0..50420b7 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -483,7 +483,8 @@
 	unsigned long 	group, block, block_nr, offset;
 	char 		*ptr;
 	errcode_t	retval;
-	int 		clen, length, i, inodes_per_block;
+	int 		clen, i, inodes_per_block;
+	unsigned int	length;
 
 	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
@@ -539,7 +540,7 @@
 	if (length > sizeof(struct ext2_inode))
 		length = sizeof(struct ext2_inode);
 	
-	if ((offset + length) > EXT2_BLOCK_SIZE(fs->super)) {
+	if ((offset + length) > (unsigned) EXT2_BLOCK_SIZE(fs->super)) {
 		clen = (int) (EXT2_BLOCK_SIZE(fs->super) - offset);
 		memcpy((char *) inode, ptr, clen);
 		length -= clen;
@@ -579,7 +580,8 @@
 	errcode_t	retval;
 	struct ext2_inode temp_inode;
 	char *ptr;
-	int clen, length, i;
+	int clen, i;
+	unsigned int length;
 
 	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
@@ -641,7 +643,7 @@
 		fs->icache->buffer_blk = block_nr;
 	}
 	
-	if ((offset + length) > EXT2_BLOCK_SIZE(fs->super)) {
+	if ((offset + length) > (unsigned) EXT2_BLOCK_SIZE(fs->super)) {
 		clen = (int) (EXT2_BLOCK_SIZE(fs->super) - offset);
 		length -= clen;
 	} else {
diff --git a/lib/ext2fs/jfs_compat.h b/lib/ext2fs/jfs_compat.h
index c8dc5af..30ad1ef 100644
--- a/lib/ext2fs/jfs_compat.h
+++ b/lib/ext2fs/jfs_compat.h
@@ -18,7 +18,7 @@
 #define cpu_to_be32(n) htonl(n)
 #define be32_to_cpu(n) ntohl(n)
 
-typedef int tid_t;
+typedef unsigned int tid_t;
 typedef struct journal_s journal_t;
 
 struct buffer_head;
diff --git a/lib/ext2fs/lookup.c b/lib/ext2fs/lookup.c
index af9fdd1..1745f33 100644
--- a/lib/ext2fs/lookup.c
+++ b/lib/ext2fs/lookup.c
@@ -29,9 +29,9 @@
  #pragma argsused
 #endif
 static int lookup_proc(struct ext2_dir_entry *dirent,
-		       int	offset,
-		       int	blocksize,
-		       char	*buf,
+		       int	offset EXT2FS_ATTR((unused)),
+		       int	blocksize EXT2FS_ATTR((unused)),
+		       char	*buf EXT2FS_ATTR((unused)),
 		       void	*priv_data)
 {
 	struct lookup_struct *ls = (struct lookup_struct *) priv_data;
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
index abf162e..427a08e 100644
--- a/lib/ext2fs/mkjournal.c
+++ b/lib/ext2fs/mkjournal.c
@@ -94,7 +94,8 @@
 {
 	errcode_t	retval;
 	char		*buf = 0;
-	int		i, fd, ret_size;
+	int		fd, ret_size;
+	blk_t		i;
 
 	if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf)))
 		return retval;
@@ -112,7 +113,7 @@
 		retval = errno;
 		goto errout;
 	}
-	if (ret_size != fs->blocksize)
+	if (ret_size != (int) fs->blocksize)
 		goto errout;
 	memset(buf, 0, fs->blocksize);
 
@@ -122,7 +123,7 @@
 			retval = errno;
 			goto errout;
 		}
-		if (ret_size != fs->blocksize)
+		if (ret_size != (int) fs->blocksize)
 			goto errout;
 	}
 	close(fd);
@@ -143,12 +144,12 @@
 	errcode_t	err;
 };
 
-static int mkjournal_proc(ext2_filsys		fs,
-			   blk_t		*blocknr,
-			   e2_blkcnt_t		blockcnt,
-			   blk_t		ref_block,
-			   int			ref_offset,
-			   void			*priv_data)
+static int mkjournal_proc(ext2_filsys	fs,
+			   blk_t	*blocknr,
+			   e2_blkcnt_t	blockcnt,
+			   blk_t	ref_block EXT2FS_ATTR((unused)),
+			   int		ref_offset EXT2FS_ATTR((unused)),
+			   void		*priv_data)
 {
 	struct mkjournal_struct *es = (struct mkjournal_struct *) priv_data;
 	blk_t	new_blk;
@@ -255,8 +256,8 @@
 	errcode_t	retval;
 	char		buf[1024];
 	journal_superblock_t	*jsb;
-	int		i, start;
-	__u32		nr_users;
+	int		start;
+	__u32		i, nr_users;
 
 	/* Make sure the device exists and is a block device */
 	if (stat(journal_dev->device_name, &st) < 0)
@@ -277,7 +278,7 @@
 	    (jsb->s_header.h_blocktype != (unsigned) ntohl(JFS_SUPERBLOCK_V2)))
 		return EXT2_ET_NO_JOURNAL_SB;
 
-	if (ntohl(jsb->s_blocksize) != fs->blocksize)
+	if (ntohl(jsb->s_blocksize) != (unsigned long) fs->blocksize)
 		return EXT2_ET_UNEXPECTED_BLOCK_SIZE;
 
 	/* Check and see if this filesystem has already been added */
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 7dd5737..bc7c5bb 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -71,11 +71,13 @@
  *	EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device
  */
 errcode_t ext2fs_open(const char *name, int flags, int superblock,
-		      int block_size, io_manager manager, ext2_filsys *ret_fs)
+		      unsigned int block_size, io_manager manager, 
+		      ext2_filsys *ret_fs)
 {
 	ext2_filsys	fs;
 	errcode_t	retval;
-	int		i, j, groups_per_block, blocks_per_group;
+	unsigned long	i;
+	int		j, groups_per_block, blocks_per_group;
 	blk_t		group_block, blk;
 	char		*dest;
 	struct ext2_group_desc *gdp;
diff --git a/lib/ext2fs/read_bb.c b/lib/ext2fs/read_bb.c
index d0f3139..c717adc 100644
--- a/lib/ext2fs/read_bb.c
+++ b/lib/ext2fs/read_bb.c
@@ -38,8 +38,10 @@
  #pragma argsused
 #endif
 static int mark_bad_block(ext2_filsys fs, blk_t *block_nr,
-			  e2_blkcnt_t blockcnt, blk_t ref_block,
-			  int ref_offset, void *priv_data)
+			  e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), 
+			  blk_t ref_block EXT2FS_ATTR((unused)),
+			  int ref_offset EXT2FS_ATTR((unused)), 
+			  void *priv_data)
 {
 	struct read_bb_record *rb = (struct read_bb_record *) priv_data;
 	
diff --git a/lib/ext2fs/read_bb_file.c b/lib/ext2fs/read_bb_file.c
index f671b92..40c34ee 100644
--- a/lib/ext2fs/read_bb_file.c
+++ b/lib/ext2fs/read_bb_file.c
@@ -72,7 +72,8 @@
 }
 
 static void call_compat_invalid(ext2_filsys fs, blk_t blk,
-				char *badstr, void *priv_data)
+				char *badstr EXT2FS_ATTR((unused)), 
+				void *priv_data)
 {
 	void (*invalid)(ext2_filsys, blk_t);
 
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index 2c5f397..ff3dd59 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -96,9 +96,9 @@
 errcode_t ext2fs_write_block_bitmap (ext2_filsys fs)
 {
 	dgrp_t 		i;
-	int		j;
+	unsigned int	j;
 	int		nbytes;
-	int		nbits;
+	unsigned int	nbits;
 	errcode_t	retval;
 	char * block_bitmap = fs->block_map->bitmap;
 	char * bitmap_block = NULL;
@@ -119,9 +119,9 @@
 		memcpy(bitmap_block, block_bitmap, nbytes);
 		if (i == fs->group_desc_count - 1) {
 			/* Force bitmap padding for the last group */
-			nbits = (int) ((fs->super->s_blocks_count
-					- fs->super->s_first_data_block)
-				       % EXT2_BLOCKS_PER_GROUP(fs->super));
+			nbits = ((fs->super->s_blocks_count
+				  - fs->super->s_first_data_block)
+				 % EXT2_BLOCKS_PER_GROUP(fs->super));
 			if (nbits)
 				for (j = nbits; j < fs->blocksize * 8; j++)
 					ext2fs_set_bit(j, bitmap_block);
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 2c732e9..5b2f364 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -113,7 +113,7 @@
 			      int count, void *buf)
 {
 	errcode_t	retval;
-	size_t		size;
+	ssize_t		size;
 	ext2_loff_t	location;
 	int		actual = 0;
 
@@ -199,7 +199,7 @@
 			       unsigned long block,
 			       int count, const void *buf)
 {
-	size_t		size;
+	ssize_t		size;
 	ext2_loff_t	location;
 	int		actual = 0;
 	errcode_t	retval;
@@ -260,8 +260,7 @@
 }
 
 /* Free the cache buffers */
-static void free_cache(io_channel channel, 
-		       struct unix_private_data *data)
+static void free_cache(struct unix_private_data *data)
 {
 	struct unix_cache	*cache;
 	int			i;
@@ -284,8 +283,7 @@
  * eldest is a non-zero pointer, then fill in eldest with the cache
  * entry to that should be reused.
  */
-static struct unix_cache *find_cached_block(io_channel channel,
-					    struct unix_private_data *data,
+static struct unix_cache *find_cached_block(struct unix_private_data *data,
 					    unsigned long block,
 					    struct unix_cache **eldest)
 {
@@ -451,7 +449,7 @@
 
 cleanup:
 	if (data) {
-		free_cache(io, data);
+		free_cache(data);
 		ext2fs_free_mem(&data);
 	}
 	if (io)
@@ -477,7 +475,7 @@
 
 	if (close(data->dev) < 0)
 		retval = errno;
-	free_cache(channel, data);
+	free_cache(data);
 
 	ext2fs_free_mem(&channel->private_data);
 	if (channel->name)
@@ -502,7 +500,7 @@
 #endif
 		
 		channel->block_size = blksize;
-		free_cache(channel, data);
+		free_cache(data);
 		if ((retval = alloc_cache(channel, data)))
 			return retval;
 	}
@@ -539,8 +537,7 @@
 	cp = buf;
 	while (count > 0) {
 		/* If it's in the cache, use it! */
-		if ((cache = find_cached_block(channel, data, block,
-					       &reuse[0]))) {
+		if ((cache = find_cached_block(data, block, &reuse[0]))) {
 #ifdef DEBUG
 			printf("Using cached block %d\n", block);
 #endif
@@ -555,8 +552,7 @@
 		 * single read request
 		 */
 		for (i=1; i < count; i++)
-			if (find_cached_block(channel, data, block+i,
-					      &reuse[i]))
+			if (find_cached_block(data, block+i, &reuse[i]))
 				break;
 #ifdef DEBUG
 		printf("Reading %d blocks starting at %d\n", i, block);
@@ -614,7 +610,7 @@
 	
 	cp = buf;
 	while (count > 0) {
-		cache = find_cached_block(channel, data, block, &reuse);
+		cache = find_cached_block(data, block, &reuse);
 		if (!cache) {
 			cache = reuse;
 			reuse_cache(channel, data, cache, block);
@@ -634,7 +630,7 @@
 {
 	struct unix_private_data *data;
 	errcode_t	retval = 0;
-	size_t		actual;
+	ssize_t		actual;
 
 	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
 	data = (struct unix_private_data *) channel->private_data;
diff --git a/lib/ext2fs/unlink.c b/lib/ext2fs/unlink.c
index 03825c4..5612b3d 100644
--- a/lib/ext2fs/unlink.c
+++ b/lib/ext2fs/unlink.c
@@ -30,9 +30,9 @@
  #pragma argsused
 #endif
 static int unlink_proc(struct ext2_dir_entry *dirent,
-		     int	offset,
-		     int	blocksize,
-		     char	*buf,
+		     int	offset EXT2FS_ATTR((unused)),
+		     int	blocksize EXT2FS_ATTR((unused)),
+		     char	*buf EXT2FS_ATTR((unused)),
 		     void	*priv_data)
 {
 	struct link_struct *ls = (struct link_struct *) priv_data;
@@ -55,7 +55,7 @@
 #endif
 errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir,
 			const char *name, ext2_ino_t ino,
-			int flags)
+			int flags EXT2FS_ATTR((unused)))
 {
 	errcode_t	retval;
 	struct link_struct ls;
diff --git a/lib/ext2fs/write_bb_file.c b/lib/ext2fs/write_bb_file.c
index 011c480..269b576 100644
--- a/lib/ext2fs/write_bb_file.c
+++ b/lib/ext2fs/write_bb_file.c
@@ -15,7 +15,7 @@
 #include "ext2fs.h"
 
 errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
-			       unsigned int flags,
+			       unsigned int flags EXT2FS_ATTR((unused)),
 			       FILE *f)
 {
 	badblocks_iterate	bb_iter;
diff --git a/lib/ss/ChangeLog b/lib/ss/ChangeLog
index 25e84e1..dbe8a05 100644
--- a/lib/ss/ChangeLog
+++ b/lib/ss/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-07  Theodore Ts'o  <tytso@mit.edu>
+
+	* list_rqs.c, listen.c, requests.c, ss.h, ss_internal.h: Fix gcc
+		-Wall nitpicks.
+
 2003-07-25  Theodore Ts'o  <tytso@mit.edu>
 
 	* Release of E2fsprogs 1.34
diff --git a/lib/ss/list_rqs.c b/lib/ss/list_rqs.c
index b1fc5ed..770f5f0 100644
--- a/lib/ss/list_rqs.c
+++ b/lib/ss/list_rqs.c
@@ -17,26 +17,18 @@
 
 typedef void sigret_t;
 
-#ifdef lint     /* "lint returns a value which is sometimes ignored" */
-#define DONT_USE(x)     x=x;
-#else /* !lint */
-#define DONT_USE(x)     ;
-#endif /* lint */
-
 static char const twentyfive_spaces[26] =
     "                         ";
 static char const NL[2] = "\n";
 
-void ss_list_requests(argc, argv, sci_idx, info_ptr)
-    int argc;
-    char const * const * argv;
-    int sci_idx;
-    pointer info_ptr;
+void ss_list_requests(int argc __SS_ATTR((unused)),
+		      const char * const *argv __SS_ATTR((unused)),
+		      int sci_idx, void *infop __SS_ATTR((unused)))
 {
-    register ss_request_entry *entry;
-    register char const * const *name;
-    register int spacing;
-    register ss_request_table **table;
+    ss_request_entry *entry;
+    char const * const *name;
+    int spacing;
+    ss_request_table **table;
 
     char buffer[BUFSIZ];
     FILE *output;
@@ -47,9 +39,6 @@
     int waitb;
 #endif
 
-    DONT_USE(argc);
-    DONT_USE(argv);
-
     sigemptyset(&igmask);
     sigaddset(&igmask, SIGINT);
     sigprocmask(SIG_BLOCK, &igmask, &omask);
@@ -69,7 +58,7 @@
             if (entry->flags & SS_OPT_DONT_LIST)
                 continue;
             for (name = entry->command_names; *name; name++) {
-                register int len = strlen(*name);
+                int len = strlen(*name);
                 strncat(buffer, *name, len);
                 spacing += len + 2;
                 if (name[1]) {
diff --git a/lib/ss/listen.c b/lib/ss/listen.c
index 784af44..05d0dc0 100644
--- a/lib/ss/listen.c
+++ b/lib/ss/listen.c
@@ -28,7 +28,7 @@
 static jmp_buf listen_jmpb;
 static sigret_t (*sig_cont)(int);
 
-static sigret_t print_prompt(int sig)
+static sigret_t print_prompt(int sig __SS_ATTR((unused)))
 {
     if (current_info->redisplay)
 	    (*current_info->redisplay)();
@@ -38,7 +38,7 @@
     }
 }
 
-static sigret_t listen_int_handler(int sig)
+static sigret_t listen_int_handler(int sig __SS_ATTR((unused)))
 {
     putc('\n', stdout);
     signal(SIGINT, listen_int_handler);
@@ -133,7 +133,9 @@
     
 }
 
-void ss_quit(int argc, const char * const *argv, int sci_idx, pointer infop)
+void ss_quit(int argc __SS_ATTR((unused)), 
+	     const char * const *argv __SS_ATTR((unused)), 
+	     int sci_idx, pointer infop __SS_ATTR((unused)))
 {
     ss_abort_subsystem(sci_idx, 0);
 }
@@ -185,7 +187,8 @@
 	return 0;
 }
 
-char **ss_rl_completion(const char *text, int start, int end)
+char **ss_rl_completion(const char *text, int start, 
+			int end __SS_ATTR((unused)))
 {
 	if ((start == 0) && current_info->rl_completion_matches)
 		return (*current_info->rl_completion_matches)
diff --git a/lib/ss/requests.c b/lib/ss/requests.c
index 7f1805d..8013368 100644
--- a/lib/ss/requests.c
+++ b/lib/ss/requests.c
@@ -22,8 +22,9 @@
 /*
  * ss_self_identify -- assigned by default to the "." request
  */
-void ss_self_identify(int argc,const char * const *argv,
-		      int sci_idx, void *infop)
+void ss_self_identify(int argc __SS_ATTR((unused)),
+		      const char * const *argv __SS_ATTR((unused)),
+		      int sci_idx, void *infop __SS_ATTR((unused)))
 {
      register ss_data *info = ss_info(sci_idx);
      printf("%s version %s\n", info->subsystem_name,
@@ -33,8 +34,10 @@
 /*
  * ss_subsystem_name -- print name of subsystem
  */
-void ss_subsystem_name(int argc,const char * const *argv,
-		       int sci_idx, void *infop)
+void ss_subsystem_name(int argc __SS_ATTR((unused)),
+		       const char * const *argv __SS_ATTR((unused)),
+		       int sci_idx, 
+		       void *infop __SS_ATTR((unused)))
 {
      printf("%s\n", ss_info(sci_idx)->subsystem_name);
 }
@@ -42,8 +45,10 @@
 /*
  * ss_subsystem_version -- print version of subsystem
  */
-void ss_subsystem_version(int argc,const char * const *argv,
-			  int sci_idx, void *infop)
+void ss_subsystem_version(int argc __SS_ATTR((unused)),
+			  const char * const *argv __SS_ATTR((unused)),
+			  int sci_idx, 
+			  void *infop __SS_ATTR((unused)))
 {
      printf("%s\n", ss_info(sci_idx)->subsystem_version);
 }
@@ -52,8 +57,9 @@
  * ss_unimplemented -- routine not implemented (should be
  * set up as (dont_list,dont_summarize))
  */
-void ss_unimplemented(int argc,const char * const *argv,
-		      int sci_idx, void *infop)
+void ss_unimplemented(int argc __SS_ATTR((unused)),
+		      const char * const *argv __SS_ATTR((unused)),
+		      int sci_idx, void *infop __SS_ATTR((unused)))
 {
      ss_perror(sci_idx, SS_ET_UNIMPLEMENTED, "");
 }
diff --git a/lib/ss/ss.h b/lib/ss/ss.h
index 90a268a..6cc050b 100644
--- a/lib/ss/ss.h
+++ b/lib/ss/ss.h
@@ -28,6 +28,13 @@
 #define __SS_CONST const
 #define __SS_PROTO (int, const char * const *, int, void *)
 
+#ifdef __GNUC__
+#define __SS_ATTR(x) __attribute__(x)
+#else
+#define __SS_ATTR(x)
+#endif
+
+
 typedef __SS_CONST struct _ss_request_entry {
     __SS_CONST char * __SS_CONST *command_names; /* whatever */
     void (* __SS_CONST function) __SS_PROTO; /* foo */
@@ -60,8 +67,10 @@
 #endif
 
 char *ss_name(int sci_idx);
-void ss_error (int, long, char const *, ...);
+void ss_error (int, long, char const *, ...)
+	__SS_ATTR((format(printf, 3, 4)));
 void ss_perror (int, long, char const *);
+
 int ss_create_invocation(const char *, const char *, void *,
 			 ss_request_table *, int *);
 void ss_delete_invocation(int);
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 03e6cc1..74ab9ed 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-07  Theodore Ts'o  <tytso@mit.edu>
+
+	* badblocks.c, blkid.c, chattr.c, dumpe2fs.c, e2image.c, fsck.c,
+		fsck.h, lsattr.c, mke2fs.c, nls-enable.h, tune2fs.c,
+		util.c: Fix gcc -Wall nitpicks.
+
 2003-09-13  Theodore Ts'o  <tytso@mit.edu>
  
         * tune2fs.c (parse_e2label_options, parse_tune2fs_options,
diff --git a/misc/badblocks.c b/misc/badblocks.c
index aae4842..2c5e17e 100644
--- a/misc/badblocks.c
+++ b/misc/badblocks.c
@@ -146,7 +146,7 @@
 	fflush (stderr);
 }
 
-static void alarm_intr(int alnum)
+static void alarm_intr(int alnum EXT2FS_ATTR((unused)))
 {
 	signal (SIGALRM, alarm_intr);
 	alarm(1);
@@ -159,7 +159,7 @@
 
 static void *terminate_addr = NULL;
 
-static void terminate_intr(int signo)
+static void terminate_intr(int signo EXT2FS_ATTR((unused)))
 {
 	if (terminate_addr)
 		longjmp(terminate_addr,1);
@@ -216,15 +216,15 @@
 static void pattern_fill(unsigned char *buffer, unsigned long pattern,
 			 size_t n)
 {
-	int	i, nb;
+	unsigned int	i, nb;
 	unsigned char	bpattern[sizeof(pattern)], *ptr;
 	
-	if (pattern == ~0) {
+	if (pattern == (unsigned char) ~0) {
 		for (ptr = buffer; ptr < buffer + n; ptr++) {
 			(*ptr) = random() % (1 << (8 * sizeof(char)));
 		}
 		if (s_flag | v_flag)
-			fprintf(stderr, _("Testing with random pattern: "));
+			fputs(_("Testing with random pattern: "), stderr);
 	} else {
 		bpattern[0] = 0;
 		for (i = 0; i < sizeof(bpattern); i++) {
@@ -235,15 +235,17 @@
 		}
 		nb = i ? (i-1) : 0;
 		for (ptr = buffer, i = nb; ptr < buffer + n; ptr++) {
-			*ptr = bpattern[i--];
-			if (i < 0)
+			*ptr = bpattern[i];
+			if (i == 0)
 				i = nb;
+			else
+				i--;
 		}
 		if (s_flag | v_flag) {
-			fprintf(stderr, _("Testing with pattern 0x"));
+			fputs(_("Testing with pattern 0x"), stderr);
 			for (i = 0; i <= nb; i++)
 				fprintf(stderr, "%02x", buffer[i]);
-			fprintf(stderr, ": ");
+			fputs(": ", stderr);
 		}
 	}
 }
@@ -301,8 +303,7 @@
 	if (got < 0)
 		got = 0;	
 	if (got & 511)
-		fprintf (stderr,
-			 "Weird value (%ld) in do_write\n", got);
+		fprintf(stderr, "Weird value (%ld) in do_write\n", got);
 	got /= block_size;
 	return got;
 }
@@ -353,7 +354,7 @@
 		     last_block);
 	}
 	if (t_flag) {
-		fprintf(stderr, _("Checking for bad blocks in read-only mode\n"));
+		fputs(_("Checking for bad blocks in read-only mode\n"), stderr);
 		pattern_fill(blkbuf + blocks_at_once * block_size,
 			     t_patts[0], block_size);
 	}
@@ -362,8 +363,7 @@
 	currently_testing = from_count;
 	num_blocks = last_block;
 	if (!t_flag && (s_flag || v_flag)) {
-		fprintf(stderr,
-			_("Checking for bad blocks (read-only test): "));
+		fputs(_("Checking for bad blocks (read-only test): "), stderr);
 		if (v_flag <= 1)
 			alarm_intr(SIGALRM);
 	}
@@ -396,7 +396,7 @@
 		if (got == try) {
 			try = blocks_at_once;
 			/* recover page-aligned offset for O_DIRECT */
-			if ( blocks_at_once >= (sys_page_size >> 9)
+			if ( blocks_at_once >= (unsigned long) (sys_page_size >> 9)
 			     && (currently_testing % (sys_page_size >> 9)!= 0))
 				try -= (sys_page_size >> 9)
 					- (currently_testing 
@@ -443,8 +443,8 @@
 	flush_bufs();
 
 	if (v_flag) {
-		fprintf(stderr,
-			_("Checking for bad blocks in read-write mode\n"));
+		fputs(_("Checking for bad blocks in read-write mode\n"), 
+		      stderr);
 		fprintf(stderr, _("From block %lu to %lu\n"),
 			 from_count, last_block);
 	}
@@ -476,7 +476,7 @@
 			if (got == try) {
 				try = blocks_at_once;
 				/* recover page-aligned offset for O_DIRECT */
-				if ( blocks_at_once >= (sys_page_size >> 9)
+				if ( blocks_at_once >= (unsigned long) (sys_page_size >> 9)
 				     && (currently_testing % 
 					 (sys_page_size >> 9)!= 0))
 					try -= (sys_page_size >> 9)
@@ -496,7 +496,7 @@
 			fputs(done_string, stderr);
 		flush_bufs();
 		if (s_flag | v_flag)
-			fprintf (stderr, _("Reading and comparing: "));
+			fputs(_("Reading and comparing: "), stderr);
 		num_blocks = last_block;
 		currently_testing = from_count;
 		if (s_flag && v_flag <= 1)
@@ -520,7 +520,7 @@
 			}
 			currently_testing += got;
 			/* recover page-aligned offset for O_DIRECT */
-			if ( blocks_at_once >= (sys_page_size >> 9)
+			if ( blocks_at_once >= (unsigned long) (sys_page_size >> 9)
 			     && (currently_testing % (sys_page_size >> 9)!= 0))
 				try = blocks_at_once - (sys_page_size >> 9)
 					- (currently_testing 
@@ -563,9 +563,10 @@
 	static int num_saved;
 	jmp_buf terminate_env;
 	errcode_t errcode;
-	long buf_used;
-	unsigned int bb_count = 0;
+	unsigned long buf_used;
+	static unsigned int bb_count;
 
+	bb_count = 0;
 	errcode = ext2fs_badblocks_list_iterate_begin(bb_list,&bb_iter);
 	if (errcode) {
 		com_err (program_name, errcode,
@@ -591,19 +592,18 @@
 
 	flush_bufs();
 	if (v_flag) {
-	    fprintf (stderr,
-		     _("Checking for bad blocks in non-destructive read-write mode\n"));
+	    fputs(_("Checking for bad blocks in non-destructive read-write mode\n"), stderr);
 	    fprintf (stderr, _("From block %lu to %lu\n"), from_count, last_block);
 	}
 	if (s_flag || v_flag > 1) {
-		fprintf(stderr, _("Checking for bad blocks (non-destructive read-write test)\n"));
+		fputs(_("Checking for bad blocks (non-destructive read-write test)\n"), stderr);
 	}
 	if (setjmp(terminate_env)) {
 		/*
 		 * Abnormal termination by a signal is handled here.
 		 */
 		signal (SIGALRM, SIG_IGN);
-		fprintf(stderr, _("\nInterrupt caught, cleaning up\n"));
+		fputs(_("\nInterrupt caught, cleaning up\n"), stderr);
 
 		save_ptr = save_base;
 		for (i=0; i < num_saved; i++) {
@@ -787,11 +787,11 @@
 
 	fprintf(stderr, _("%s is mounted; "), device_name);
 	if (force) {
-		fprintf(stderr, _("badblocks forced anyway.  "
-			"Hope /etc/mtab is incorrect.\n"));
+		fputs(_("badblocks forced anyway.  "
+			"Hope /etc/mtab is incorrect.\n"), stderr);
 		return;
 	}
-	fprintf(stderr, _("it's not safe to run badblocks!\n"));
+	fputs(_("it's not safe to run badblocks!\n"), stderr);
 	exit(1);
 }
 
@@ -925,7 +925,7 @@
 						optarg);
 					exit(1);
 				}
-				if (pattern == ~0)
+				if (pattern == (unsigned long) ~0)
 					pattern = 0xffff;
 				t_patts[t_flag++] = pattern;
 			}
@@ -941,7 +941,7 @@
 			  "in read-only mode"));
 			exit(1);
 		}
-		if (t_patts && (t_patts[0] == ~0)) {
+		if (t_patts && (t_patts[0] == (unsigned long) ~0)) {
 			com_err(program_name, 0,
 			_("Random test_pattern is not allowed "
 			  "in read-only mode"));
@@ -985,7 +985,7 @@
 	} else from_count = 0;
 	if (from_count >= last_block) {
 	    com_err (program_name, 0, _("bad blocks range: %lu-%lu"),
-		     from_count, last_block);
+		     (unsigned long) from_count, (unsigned long) last_block);
 	    exit (1);
 	}
 	if (w_flag)
diff --git a/misc/blkid.c b/misc/blkid.c
index 2b71a56..9caebbd 100644
--- a/misc/blkid.c
+++ b/misc/blkid.c
@@ -25,7 +25,7 @@
 
 static void print_version(FILE *out)
 {
-	fprintf(stderr, "%s %s (%s)\n", progname, BLKID_VERSION, BLKID_DATE);
+	fprintf(out, "%s %s (%s)\n", progname, BLKID_VERSION, BLKID_DATE);
 }
 
 static void usage(int error)
@@ -85,10 +85,10 @@
 	char *search_type = NULL, *search_value = NULL;
 	char *read = NULL;
 	char *write = NULL;
-	int numdev = 0, numtag = 0;
+	unsigned int numdev = 0, numtag = 0;
 	int version = 0;
 	int err = 4;
-	int i;
+	unsigned int i;
 	char c;
 
 	while ((c = getopt (argc, argv, "c:f:hps:t:w:v")) != EOF)
diff --git a/misc/chattr.c b/misc/chattr.c
index 4ff1564..b4b1ca3 100644
--- a/misc/chattr.c
+++ b/misc/chattr.c
@@ -34,6 +34,12 @@
 #include <sys/stat.h>
 #include "ext2fs/ext2_fs.h"
 
+#ifdef __GNUC__
+#define EXT2FS_ATTR(x) __attribute__(x)
+#else
+#define EXT2FS_ATTR(x)
+#endif
+
 #ifndef S_ISLNK			/* So we can compile even with gcc-warn */
 # ifdef __S_IFLNK
 #  define S_ISLNK(mode)	 __S_ISTYPE((mode), __S_IFLNK)
@@ -239,7 +245,7 @@
 }
 
 static int chattr_dir_proc (const char * dir_name, struct dirent * de,
-			    void * unused_private)
+			    void * private EXT2FS_ATTR((unused)))
 {
 	if (strcmp (de->d_name, ".") && strcmp (de->d_name, "..")) {
 	        char *path;
@@ -278,15 +284,15 @@
 	if (i >= argc)
 		usage ();
 	if (set && (add || rem)) {
-		fprintf (stderr, _("= is incompatible with - and +\n"));
+		fputs(_("= is incompatible with - and +\n"), stderr);
 		exit (1);
 	}
 	if ((rf & af) != 0) {
-		fprintf (stderr, "Can't both set and unset same flag.\n");
+		fputs("Can't both set and unset same flag.\n", stderr);
 		exit (1);
 	}
 	if (!(add || rem || set || set_version)) {
-		fprintf (stderr, _("Must use '-v', =, - or +\n"));
+		fputs(_("Must use '-v', =, - or +\n"), stderr);
 		exit (1);
 	}
 	if (verbose)
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index d04fe16..da8fdfa 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -56,6 +56,11 @@
 	exit (1);
 }
 
+static void print_number (unsigned long num)
+{
+	printf(num_format, num);
+}
+
 static void print_free (unsigned long group, char * bitmap,
 			unsigned long nbytes, unsigned long offset)
 {
@@ -69,12 +74,12 @@
 		{
 			if (p)
 				printf (", ");
-			printf (num_format, i + offset);
+			print_number(i + offset);
 			for (j = i; j < nbytes && !in_use (bitmap, j); j++)
 				;
 			if (--j != i) {
 				fputc('-', stdout);
-				printf(num_format, j + offset);
+				print_number(j + offset);
 				i = j;
 			}
 			p = 1;
@@ -119,7 +124,7 @@
 		if (has_super) {
 			printf (_("  %s superblock at "),
 				i == 0 ? _("Primary") : _("Backup"));
-			printf(num_format, super_blk);
+			print_number(super_blk);
 		}
 		if (old_desc_blk) {
 			printf(_(", Group descriptors at "));
@@ -128,18 +133,18 @@
 		} else if (new_desc_blk) {
 			fputc(has_super ? ',' : ' ', stdout);
 			printf(_(" Group descriptor at "));
-			printf(num_format, new_desc_blk);
+			print_number(new_desc_blk);
 			has_super++;
 		}
 		if (has_super)
 			fputc('\n', stdout);
 		fputs(_("  Block bitmap at "), stdout);
-		printf(num_format, fs->group_desc[i].bg_block_bitmap);
+		print_number(fs->group_desc[i].bg_block_bitmap);
 		diff = fs->group_desc[i].bg_block_bitmap - group_blk;
 		if (diff >= 0)
 			printf(" (+%ld)", diff);
 		fputs(_(", Inode bitmap at "), stdout);
-		printf(num_format, fs->group_desc[i].bg_inode_bitmap);
+		print_number(fs->group_desc[i].bg_inode_bitmap);
 		diff = fs->group_desc[i].bg_inode_bitmap - group_blk;
 		if (diff >= 0)
 			printf(" (+%ld)", diff);
@@ -213,7 +218,7 @@
 	errcode_t	retval;
 	char		buf[1024];
 	char		str[80];
-	int		i;
+	unsigned int	i;
 	journal_superblock_t	*jsb;
 
 	/* Get the journal superblock */
diff --git a/misc/e2image.c b/misc/e2image.c
index 1cb2a1d..c6d9dcf 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -58,7 +58,7 @@
 
 	header_buf = malloc(blocksize);
 	if (!header_buf) {
-		fprintf(stderr, _("Couldn't allocate header buffer\n"));
+		fputs(_("Couldn't allocate header buffer\n"), stderr);
 		exit(1);
 	}
 
@@ -160,8 +160,9 @@
 static ino_t stashed_ino = 0;
 static struct ext2_inode *stashed_inode;
 
-static errcode_t meta_get_blocks(ext2_filsys fs, ext2_ino_t ino,
-				  blk_t *blocks)
+static errcode_t meta_get_blocks(ext2_filsys fs EXT2FS_ATTR((unused)), 
+				 ext2_ino_t ino,
+				 blk_t *blocks)
 {
 	int	i;
 	
@@ -173,7 +174,8 @@
 	return 0;
 }
 
-static errcode_t meta_check_directory(ext2_filsys fs, ext2_ino_t ino)
+static errcode_t meta_check_directory(ext2_filsys fs EXT2FS_ATTR((unused)), 
+				      ext2_ino_t ino)
 {
 	if ((ino != stashed_ino) || !stashed_inode)
 		return EXT2_ET_CALLBACK_NOTHANDLED;
@@ -183,7 +185,8 @@
 	return 0;
 }
 
-static errcode_t meta_read_inode(ext2_filsys fs, ext2_ino_t ino,
+static errcode_t meta_read_inode(ext2_filsys fs EXT2FS_ATTR((unused)), 
+				 ext2_ino_t ino,
 				 struct ext2_inode *inode)
 {
 	if ((ino != stashed_ino) || !stashed_inode)
@@ -206,17 +209,23 @@
 	}
 }
 
-static int process_dir_block(ext2_filsys fs, blk_t *block_nr,
-			     e2_blkcnt_t blockcnt, blk_t ref_block,
-			     int ref_offset, void *priv_data)
+static int process_dir_block(ext2_filsys fs EXT2FS_ATTR((unused)), 
+			     blk_t *block_nr,
+			     e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), 
+			     blk_t ref_block EXT2FS_ATTR((unused)),
+			     int ref_offset EXT2FS_ATTR((unused)), 
+			     void *priv_data EXT2FS_ATTR((unused)))
 {
 	ext2fs_mark_block_bitmap(meta_block_map, *block_nr);
 	return 0;
 }
 
-static int process_file_block(ext2_filsys fs, blk_t *block_nr,
-			     e2_blkcnt_t blockcnt, blk_t ref_block,
-			     int ref_offset, void *priv_data)
+static int process_file_block(ext2_filsys fs EXT2FS_ATTR((unused)), 
+			      blk_t *block_nr,
+			      e2_blkcnt_t blockcnt, 
+			      blk_t ref_block EXT2FS_ATTR((unused)),
+			      int ref_offset EXT2FS_ATTR((unused)), 
+			      void *priv_data EXT2FS_ATTR((unused)))
 {
 	if (blockcnt < 0) {
 		ext2fs_mark_block_bitmap(meta_block_map, *block_nr);
@@ -227,7 +236,7 @@
 static void mark_table_blocks(ext2_filsys fs)
 {
 	blk_t	block, b;
-	int	i,j;
+	unsigned int	i,j;
 	
 	block = fs->super->s_first_data_block;
 	/*
@@ -249,7 +258,7 @@
 		 */
 		if (fs->group_desc[i].bg_inode_table) {
 			for (j = 0, b = fs->group_desc[i].bg_inode_table;
-			     j < fs->inode_blocks_per_group;
+			     j < (unsigned) fs->inode_blocks_per_group;
 			     j++, b++)
 				ext2fs_mark_block_bitmap(meta_block_map, b);
 		}
@@ -476,7 +485,7 @@
         if (retval) {
 		com_err (program_name, retval, _("while trying to open %s"),
 			 device_name);
-		printf(_("Couldn't find valid filesystem superblock.\n"));
+		fputs(_("Couldn't find valid filesystem superblock.\n"), stdout);
 		exit(1);
 	}
 
diff --git a/misc/fsck.c b/misc/fsck.c
index 28bd7a2..bebf5ee 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -353,10 +353,10 @@
 	fclose(f);
 	
 	if (old_fstab) {
-		fprintf(stderr, _("\007\007\007"
+		fputs(_("\007\007\007"
 		"WARNING: Your /etc/fstab does not contain the fsck passno\n"
 		"	field.  I will kludge around things for you, but you\n"
-		"	should fix your /etc/fstab file as soon as you can.\n\n"));
+		"	should fix your /etc/fstab file as soon as you can.\n\n"), stderr);
 		
 		for (fs = filesys_info; fs; fs = fs->next) {
 			fs->passno = 1;
@@ -729,8 +729,8 @@
 	cmp->list = malloc(num * sizeof(char *));
 	cmp->type = malloc(num * sizeof(int));
 	if (!cmp->list || !cmp->type) {
-		fprintf(stderr, _("Couldn't allocate memory for "
-				  "filesystem types\n"));
+		fputs(_("Couldn't allocate memory for filesystem types\n"), 
+		      stderr);
 		exit(EXIT_ERROR);
 	}
 	memset(cmp->list, 0, num * sizeof(char *));
@@ -766,7 +766,7 @@
 			}
 			if ((negate && !cmp->negate) ||
 			    (!negate && cmp->negate)) {
-				fprintf(stderr, _(fs_type_syntax_error));
+				fputs(_(fs_type_syntax_error), stderr);
 				exit(EXIT_USAGE);
 			}
 		}
@@ -925,7 +925,7 @@
 	int pass_done;
 
 	if (verbose)
-		printf(_("Checking all file systems.\n"));
+		fputs(_("Checking all file systems.\n"), stdout);
 
 	/*
 	 * Do an initial scan over the filesystem; mark filesystems
@@ -1031,13 +1031,12 @@
 
 static void usage(NOARGS)
 {
-	fprintf(stderr,
-		_("Usage: fsck [-ACNPRTV] [-t fstype] [fs-options] [filesys ...]\n"));
+	fputs(_("Usage: fsck [-ACNPRTV] [-t fstype] [fs-options] [filesys ...]\n"), stderr);
 	exit(EXIT_USAGE);
 }
 
 #ifdef HAVE_SIGNAL_H
-static void signal_cancel(int sig)
+static void signal_cancel(int sig FSCK_ATTR((unused)))
 {
 	cancel_requested++;
 }
diff --git a/misc/fsck.h b/misc/fsck.h
index 56afcf9..55cb525 100644
--- a/misc/fsck.h
+++ b/misc/fsck.h
@@ -11,6 +11,13 @@
 #define const
 #endif
 
+#ifdef __GNUC__
+#define FSCK_ATTR(x) __attribute__(x)
+#else
+#define FSCK_ATTR(x)
+#endif
+
+
 #ifndef DEFAULT_FSTYPE
 #define DEFAULT_FSTYPE	"ext2"
 #endif
diff --git a/misc/lsattr.c b/misc/lsattr.c
index 513b41a..ff3859f 100644
--- a/misc/lsattr.c
+++ b/misc/lsattr.c
@@ -45,6 +45,12 @@
 #include "../version.h"
 #include "nls-enable.h"
 
+#ifdef __GNUC__
+#define EXT2FS_ATTR(x) __attribute__(x)
+#else
+#define EXT2FS_ATTR(x)
+#endif
+
 static const char * program_name = "lsattr";
 
 static int all;
@@ -114,7 +120,8 @@
 	}
 }
 
-static int lsattr_dir_proc (const char * dir_name, struct dirent * de, void * private)
+static int lsattr_dir_proc (const char * dir_name, struct dirent * de, 
+			    void * private EXT2FS_ATTR((unused)))
 {
 	STRUCT_STAT	st;
 	char *path;
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 96f7b71..e225d00 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -189,7 +189,7 @@
 /*
  * Helper function for read_bb_file and test_disk
  */
-static void invalid_block(ext2_filsys fs, blk_t blk)
+static void invalid_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t blk)
 {
 	fprintf(stderr, _("Bad block %u out of range; ignored.\n"), blk);
 	return;
@@ -250,8 +250,9 @@
 
 static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list)
 {
-	int			i, j;
-	int			must_be_good;
+	dgrp_t			i;
+	blk_t			j;
+	unsigned 		must_be_good;
 	blk_t			blk;
 	badblocks_iterate	bb_iter;
 	errcode_t		retval;
@@ -274,7 +275,7 @@
 			fprintf(stderr, _("Blocks %d through %d must be good "
 				"in order to build a filesystem.\n"),
 				fs->super->s_first_data_block, must_be_good);
-			fprintf(stderr, _("Aborting....\n"));
+			fputs(_("Aborting....\n"), stderr);
 			exit(1);
 		}
 	}
@@ -346,7 +347,7 @@
 	sprintf(progress->format, "%%%dd/%%%dld", i, i);
 	memset(progress->backup, '\b', sizeof(progress->backup)-1);
 	progress->backup[sizeof(progress->backup)-1] = 0;
-	if ((2*i)+1 < sizeof(progress->backup))
+	if ((2*i)+1 < (int) sizeof(progress->backup))
 		progress->backup[(2*i)+1] = 0;
 	progress->max = max;
 
@@ -439,7 +440,8 @@
 {
 	errcode_t	retval;
 	blk_t		blk;
-	int		i, num;
+	dgrp_t		i;
+	int		num;
 	struct progress_struct progress;
 
 	if (quiet)
@@ -655,7 +657,8 @@
 	struct ext2_super_block *s = fs->super;
 	char 			buf[80];
 	blk_t			group_block;
-	int			i, need, col_left;
+	dgrp_t			i;
+	int			need, col_left;
 	
 	if (param.s_blocks_count != s->s_blocks_count)
 		fprintf(stderr, _("warning: %d blocks unused.\n\n"),
@@ -664,12 +667,12 @@
 	memset(buf, 0, sizeof(buf));
 	strncpy(buf, s->s_volume_name, sizeof(s->s_volume_name));
 	printf(_("Filesystem label=%s\n"), buf);
-	printf(_("OS type: "));
+	fputs(_("OS type: "), stdout);
 	switch (fs->super->s_creator_os) {
-	    case EXT2_OS_LINUX: printf ("Linux"); break;
-	    case EXT2_OS_HURD:  printf ("GNU/Hurd");   break;
-	    case EXT2_OS_MASIX: printf ("Masix"); break;
-	    default:		printf (_("(unknown os)"));
+	    case EXT2_OS_LINUX: fputs("Linux", stdout); break;
+	    case EXT2_OS_HURD:  fputs("GNU/Hurd", stdout);   break;
+	    case EXT2_OS_MASIX: fputs ("Masix", stdout); break;
+	    default:		fputs(_("(unknown os)"), stdout);
         }
 	printf("\n");
 	printf(_("Block size=%u (log=%u)\n"), fs->blocksize,
@@ -1104,7 +1107,7 @@
 				journal_device);
 			exit(1);
 		}
-		if ((blocksize < 0) && (jfs->blocksize < -blocksize)) {
+		if ((blocksize < 0) && (jfs->blocksize < (unsigned) (-blocksize))) {
 			com_err(program_name, 0,
 				_("Journal dev blocksize (%d) smaller than "
 				  "minimum blocksize %d\n"), jfs->blocksize,
@@ -1219,7 +1222,7 @@
 		exit(1);
 	}
 
-	if (tmp = getenv("MKE2FS_DEVICE_SECTSIZE"))
+	if ((tmp = getenv("MKE2FS_DEVICE_SECTSIZE")) != NULL)
 		sector_size = atoi(tmp);
 	
 	set_fs_defaults(fs_type, &param, blocksize, sector_size, &inode_ratio);
@@ -1227,7 +1230,7 @@
 	
 	if (param.s_blocks_per_group) {
 		if (param.s_blocks_per_group < 256 ||
-		    param.s_blocks_per_group > 8 * blocksize) {
+		    param.s_blocks_per_group > 8 * (unsigned) blocksize) {
 			com_err(program_name, 0,
 				_("blocks per group count out of range"));
 			exit(1);
@@ -1271,7 +1274,8 @@
 	ext2_filsys	fs;
 	badblocks_list	bb_list = 0;
 	int		journal_blocks;
-	int		i, val;
+	unsigned int	i;
+	int		val;
 	io_manager	io_ptr;
 
 #ifdef ENABLE_NLS
@@ -1391,7 +1395,7 @@
 		fs->flags &= ~(EXT2_FLAG_IB_DIRTY|EXT2_FLAG_BB_DIRTY);
 	} else {
 		/* rsv must be a power of two (64kB is MD RAID sb alignment) */
-		int rsv = 65536 / fs->blocksize;
+		unsigned int rsv = 65536 / fs->blocksize;
 		unsigned long blocks = fs->super->s_blocks_count;
 		unsigned long start;
 		blk_t ret_blk;
diff --git a/misc/nls-enable.h b/misc/nls-enable.h
index e365fbd..d6a7db3 100644
--- a/misc/nls-enable.h
+++ b/misc/nls-enable.h
@@ -1,4 +1,5 @@
 #ifdef ENABLE_NLS
+#warning Using NLS
 #include <libintl.h>
 #include <locale.h>
 #define _(a) (gettext (a))
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index f95aed4..d8c8e2e 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -154,7 +154,7 @@
 	jsb = (journal_superblock_t *) buf;
 	if ((jsb->s_header.h_magic != (unsigned) ntohl(JFS_MAGIC_NUMBER)) ||
 	    (jsb->s_header.h_blocktype != (unsigned) ntohl(JFS_SUPERBLOCK_V2))) {
-		fprintf(stderr, _("Journal superblock not found!\n"));
+		fputs(_("Journal superblock not found!\n"), stderr);
 		goto no_valid_journal;
 	}
 
@@ -166,8 +166,8 @@
 			break;
 	}
 	if (i >= nr_users) {
-		fprintf(stderr,
-			_("Filesystem's UUID not found on journal device.\n"));
+		fputs(_("Filesystem's UUID not found on journal device.\n"), 
+		      stderr);
 		commit_remove_journal = 1;
 		goto no_valid_journal;
 	}
@@ -187,19 +187,20 @@
 
 no_valid_journal:
 	if (commit_remove_journal == 0) {
-		fprintf(stderr, _("Journal NOT removed\n"));
+		fputs(_("Journal NOT removed\n"), stderr);
 		exit(1);
 	}
 	fs->super->s_journal_dev = 0;
 	uuid_clear(fs->super->s_journal_uuid);
 	ext2fs_mark_super_dirty(fs);
-	printf(_("Journal removed\n"));
+	fputs(_("Journal removed\n"), stdout);
 	free(journal_path);
 }
 
 /* Helper function for remove_journal_inode */
 static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr,
-			       int blockcnt, void *private)
+			       int blockcnt EXT2FS_ATTR((unused)), 
+			       void *private EXT2FS_ATTR((unused)))
 {
 	blk_t	block;
 	int	group;
@@ -305,19 +306,17 @@
 	if (old_journal && !journal) {
 		if ((mount_flags & EXT2_MF_MOUNTED) &&
 		    !(mount_flags & EXT2_MF_READONLY)) {
-			fprintf(stderr,
-				_("The has_journal flag may only be "
-				  "cleared when the filesystem is\n"
-				  "unmounted or mounted "
-				  "read-only.\n"));
+			fputs(_("The has_journal flag may only be "
+				"cleared when the filesystem is\n"
+				"unmounted or mounted "
+				"read-only.\n"), stderr);
 			exit(1);
 		}
 		if (sb->s_feature_incompat &
 		    EXT3_FEATURE_INCOMPAT_RECOVER) {
-			fprintf(stderr,
-				_("The needs_recovery flag is set.  "
-				  "Please run e2fsck before clearing\n"
-				  "the has_journal flag.\n"));
+			fputs(_("The needs_recovery flag is set.  "
+				"Please run e2fsck before clearing\n"
+				"the has_journal flag.\n"), stderr);
 			exit(1);
 		}
 		if (sb->s_journal_inum) {
@@ -369,7 +368,7 @@
 
 	if (fs->super->s_feature_compat &
 	    EXT3_FEATURE_COMPAT_HAS_JOURNAL) {
-		fprintf(stderr, _("The filesystem already has a journal.\n"));
+		fputs(_("The filesystem already has a journal.\n"), stderr);
 		goto err;
 	}
 	if (journal_device) {
@@ -402,9 +401,9 @@
 				 journal_device);
 			goto err;
 		}
-		printf(_("done\n"));
+		fputs(_("done\n"), stdout);
 	} else if (journal_size) {
-		printf(_("Creating journal inode: "));
+		fputs(_("Creating journal inode: "), stdout);
 		fflush(stdout);
 		journal_blocks = figure_journal_size(journal_size, fs);
 
@@ -416,7 +415,7 @@
 				_("\n\twhile trying to create journal file"));
 			exit(1);
 		} else
-			printf(_("done\n"));
+			fputs(_("done\n"), stdout);
 		/*
 		 * If the filesystem wasn't mounted, we need to force
 		 * the block group descriptors out.
@@ -437,7 +436,7 @@
 static void parse_e2label_options(int argc, char ** argv)
 {
 	if ((argc < 2) || (argc > 3)) {
-		fprintf(stderr, _("Usage: e2label device [newlabel]\n"));
+		fputs(_("Usage: e2label device [newlabel]\n"), stderr);
 		exit(1);
 	}
 	device_name = blkid_get_devname(NULL, argv[1], NULL);
@@ -814,7 +813,7 @@
 	if (r_flag) {
 		if (reserved_blocks >= sb->s_blocks_count) {
 			com_err (program_name, 0,
-				 _("reserved blocks count is too big (%ul)"),
+				 _("reserved blocks count is too big (%lu)"),
 				 reserved_blocks);
 			exit (1);
 		}
@@ -826,8 +825,8 @@
 	if (s_flag == 1) {
 		if (sb->s_feature_ro_compat &
 		    EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)
-			fprintf(stderr, _("\nThe filesystem already"
-				" has sparse superblocks.\n"));
+			fputs(_("\nThe filesystem already has sparse "
+				"superblocks.\n"), stderr);
 		else {
 			sb->s_feature_ro_compat |=
 				EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
@@ -840,8 +839,8 @@
 	if (s_flag == 0) {
 		if (!(sb->s_feature_ro_compat &
 		      EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
-			fprintf(stderr, _("\nThe filesystem already"
-				" has sparse superblocks disabled.\n"));
+			fputs(_("\nThe filesystem already has sparse "
+				"superblocks disabled.\n"), stderr);
 		else {
 			sb->s_feature_ro_compat &=
 				~EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
@@ -865,8 +864,8 @@
 	}
 	if (L_flag) {
 		if (strlen(new_label) > sizeof(sb->s_volume_name))
-			fprintf(stderr, _("Warning: label too "
-				"long, truncating.\n"));
+			fputs(_("Warning: label too long, truncating.\n"), 
+			      stderr);
 		memset(sb->s_volume_name, 0, sizeof(sb->s_volume_name));
 		strncpy(sb->s_volume_name, new_label,
 			sizeof(sb->s_volume_name));
diff --git a/misc/util.c b/misc/util.c
index 76392ff..b5e6f94 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -69,7 +69,7 @@
 
 	fflush(stdout);
 	fflush(stderr);
-	printf(_("Proceed anyway? (y,n) "));
+	fputs(_("Proceed anyway? (y,n) "), stdout);
 	buf[0] = 0;
 	fgets(buf, sizeof(buf), stdin);
 	if (strchr(short_yes, buf[0]) == 0)
@@ -93,8 +93,8 @@
 		fprintf(stderr, _("Could not stat %s --- %s\n"),
 			device, error_message(errno));
 		if (errno == ENOENT)
-			fprintf(stderr, _("\nThe device apparently does "
-			       "not exist; did you specify it correctly?\n"));
+			fputs(_("\nThe device apparently does not exist; "
+				"did you specify it correctly?\n"), stderr);
 		exit(1);
 	}
 	if (!S_ISBLK(s.st_mode)) {
@@ -151,8 +151,8 @@
 
 	fprintf(stderr, _("%s is mounted; "), device);
 	if (force) {
-		fprintf(stderr, _("mke2fs forced anyway.  "
-			"Hope /etc/mtab is incorrect.\n"));
+		fputs(_("mke2fs forced anyway.  Hope /etc/mtab is "
+			"incorrect.\n"), stderr);
 	} else {
 		fprintf(stderr, _("will not make a %s here!\n"), type);
 		exit(1);
@@ -168,8 +168,8 @@
 	len = strlen(opts);
 	buf = malloc(len+1);
 	if (!buf) {
-		fprintf(stderr, _("Couldn't allocate memory to parse "
-			"journal options!\n"));
+		fputs(_("Couldn't allocate memory to parse journal "
+			"options!\n"), stderr);
 		exit(1);
 	}
 	strcpy(buf, opts);
@@ -210,7 +210,7 @@
 			journal_usage++;
 	}
 	if (journal_usage) {
-		fprintf(stderr, _("\nBad journal options specified.\n\n"
+		fputs(_("\nBad journal options specified.\n\n"
 			"Journal options are separated by commas, "
 			"and may take an argument which\n"
 			"\tis set off by an equals ('=') sign.\n\n"
@@ -218,7 +218,7 @@
 			"\tsize=<journal size in megabytes>\n"
 			"\tdevice=<journal device>\n\n"
 			"The journal size must be between "
-			"1024 and 102400 filesystem blocks.\n\n" ));
+			"1024 and 102400 filesystem blocks.\n\n"), stderr);
 		exit(1);
 	}
 }	
@@ -237,7 +237,7 @@
 	blk_t j_blocks;
 
 	if (fs->super->s_blocks_count < 2048) {
-		fprintf(stderr, _("\nFilesystem too small for a journal\n"));
+		fputs(_("\nFilesystem too small for a journal\n"), stderr);
 		return 0;
 	}
 	
@@ -252,8 +252,8 @@
 			exit(1);
 		}
 		if (j_blocks > fs->super->s_free_blocks_count) {
-			fprintf(stderr, _("\nJournal size too big "
-					  "for filesystem.\n"));
+			fputs(_("\nJournal size too big for filesystem.\n"),
+			      stderr);
 			exit(1);
 		}
 		return j_blocks;
diff --git a/resize/ChangeLog b/resize/ChangeLog
index 85809cc..ce98603 100644
--- a/resize/ChangeLog
+++ b/resize/ChangeLog
@@ -1,3 +1,7 @@
+2003-12-07  Theodore Ts'o  <tytso@mit.edu>
+
+	* main.c, resize2fs.c: Fix gcc -Wall nitpicks.
+
 2003-08-24  Theodore Ts'o  <tytso@mit.edu>
 
 	* resize2fs.8.in: Adjust description line so that apropos
diff --git a/resize/main.c b/resize/main.c
index 649105a..b32a7ea 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -138,7 +138,7 @@
 	io_manager	io_ptr;
 	char		*tmp;
 	struct stat	st_buf;
-	int		sys_page_size = 4096;
+	unsigned int	sys_page_size = 4096;
 	long		sysval;
 
 #ifdef ENABLE_NLS
@@ -265,9 +265,9 @@
 		exit(1);
 	}
 	if (units) {
-		if (units < fs->blocksize)
+		if ((unsigned) units < fs->blocksize)
 			new_size = (new_size * units) / fs->blocksize;
-		else if (units > fs->blocksize)
+		else if ((unsigned) units > fs->blocksize)
 			new_size = new_size * (units / fs->blocksize);
 	}
 	if (!new_size) {
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index c7970d0..5aaf8f5 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -176,9 +176,10 @@
 	errcode_t	retval;
 	ext2_ino_t	real_end;
 	blk_t		blk, group_block;
-	unsigned long	i, j;
+	unsigned long	i, j, old_desc_blocks;
 	int		old_numblocks, numblocks, adjblocks;
-	int		has_super, meta_bg, meta_bg_size, old_desc_blocks;
+	unsigned int	meta_bg, meta_bg_size;
+	int		has_super;
 	unsigned long	max_group;
 	
 	fs = rfs->new_fs;
@@ -446,8 +447,11 @@
 				   ext2fs_block_bitmap *ret_bmap)
 {
 	blk_t			block, b;
-	int			i,j, has_super, meta_bg, meta_bg_size;
-	int			old_desc_blocks;
+	unsigned int		j;
+	dgrp_t			i;
+	unsigned long		meta_bg, meta_bg_size;
+	int			has_super;
+	unsigned int		old_desc_blocks;
 	ext2fs_block_bitmap	bmap;
 	errcode_t		retval;
 
@@ -497,7 +501,7 @@
 		 * Mark the blocks used for the inode table
 		 */
 		for (j = 0, b = fs->group_desc[i].bg_inode_table;
-		     j < fs->inode_blocks_per_group;
+		     j < (unsigned int) fs->inode_blocks_per_group;
 		     j++, b++)
 			ext2fs_mark_block_bitmap(bmap, b);
 			    
@@ -560,9 +564,11 @@
  */
 static errcode_t blocks_to_move(ext2_resize_t rfs)
 {
-	int	i, j, max_groups, has_super, meta_bg, meta_bg_size;
-	blk_t	blk, group_blk;
-	unsigned long old_blocks, new_blocks;
+	int		j, has_super;
+	dgrp_t		i, max_groups;
+	blk_t		blk, group_blk;
+	unsigned long	old_blocks, new_blocks;
+	unsigned int	meta_bg, meta_bg_size;
 	errcode_t	retval;
 	ext2_filsys 	fs, old_fs;
 	ext2fs_block_bitmap	meta_bmap;
@@ -969,8 +975,9 @@
 };
 
 static int process_block(ext2_filsys fs, blk_t	*block_nr,
-			 e2_blkcnt_t blockcnt, blk_t ref_block,
-			 int ref_offset, void *priv_data)
+			 e2_blkcnt_t blockcnt, 
+			 blk_t ref_block EXT2FS_ATTR((unused)),
+			 int ref_offset EXT2FS_ATTR((unused)), void *priv_data)
 {
 	struct process_block_struct *pb;
 	errcode_t	retval;
@@ -1007,7 +1014,8 @@
 /*
  * Progress callback
  */
-static errcode_t progress_callback(ext2_filsys fs, ext2_inode_scan scan,
+static errcode_t progress_callback(ext2_filsys fs, 
+				   ext2_inode_scan scan EXT2FS_ATTR((unused)),
 				   dgrp_t group, void * priv_data)
 {
 	ext2_resize_t rfs = (ext2_resize_t) priv_data;
@@ -1192,9 +1200,12 @@
 	int		num;
 };
 
-static int check_and_change_inodes(ext2_ino_t dir, int entry,
+static int check_and_change_inodes(ext2_ino_t dir, 
+				   int entry EXT2FS_ATTR((unused)),
 				   struct ext2_dir_entry *dirent, int offset,
-				   int	blocksize, char *buf, void *priv_data)
+				   int	blocksize EXT2FS_ATTR((unused)),
+				   char *buf EXT2FS_ATTR((unused)), 
+				   void *priv_data)
 {
 	struct istruct *is = (struct istruct *) priv_data;
 	struct ext2_inode 	inode;
@@ -1299,7 +1310,8 @@
  */
 static errcode_t move_itables(ext2_resize_t rfs)
 {
-	int		i, n, num, max_groups, size, diff;
+	int		n, num, size, diff;
+	dgrp_t		i, max_groups;
 	ext2_filsys	fs = rfs->new_fs;
 	char		*cp;
 	blk_t		old_blk, new_blk;
@@ -1421,8 +1433,8 @@
 {
 	blk_t		blk;
 	ext2_ino_t	ino;
-	int		group = 0;
-	int		count = 0;
+	unsigned int	group = 0;
+	unsigned int	count = 0;
 	int		total_free = 0;
 	int		group_free = 0;
 
diff --git a/util/ChangeLog b/util/ChangeLog
index 2a21183..1501bda 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,10 @@
+2003-12-07  Theodore Ts'o  <tytso@mit.edu>
+
+	* subst.c: Fix gcc -Wall nitpicks.
+
+	* gcc-wall-cleanup: Remove missing initalizer, zero-length format
+		string, and some more long long warnings.
+
 2003-07-25  Theodore Ts'o  <tytso@mit.edu>
 
 	* Release of E2fsprogs 1.34
diff --git a/util/gcc-wall-cleanup b/util/gcc-wall-cleanup
index 4d817b1..6148e46 100644
--- a/util/gcc-wall-cleanup
+++ b/util/gcc-wall-cleanup
@@ -6,12 +6,17 @@
 /^kcc /d
 /^gcc /d
 /does not support `long long'/d
+/forbids long long integer constants/d
 /does not support the `ll' length modifier/d
+/does not support the `ll' printf length modifier/d
 /ANSI C forbids long long integer constants/d
 /traditional C rejects string concatenation/d
 /integer constant is unsigned in ANSI C, signed with -traditional/d
 /At top level:/d
 /In file included from/d
 /In function `.*':/d
+/zero-length format string/d
+/warning: missing initializer/d
+/warning: (near initialization for/d
 /^[ 	]*from/d
 
diff --git a/util/subst.c b/util/subst.c
index 7b7ba83..dff1848 100644
--- a/util/subst.c
+++ b/util/subst.c
@@ -74,7 +74,7 @@
  * Given the starting and ending position of the replacement name,
  * check to see if it is valid, and pull it out if it is.
  */
-static char *get_subst_symbol(const char *begin, int len, char prefix)
+static char *get_subst_symbol(const char *begin, size_t len, char prefix)
 {
 	static char replace_name[128];
 	char *cp, *start;
@@ -121,7 +121,7 @@
 	char	*ptr, *name_ptr, *end_ptr;
 	struct subst_entry *ent;
 	char	*replace_name;
-	int	len;
+	size_t	len;
 
 	/*
 	 * Expand all @FOO@ substitutions