ChangeLog, message.c, pass1b.c, pass2.c, pass3.c, problem.c, problem.h:
  pass1b.c: Change routines to use PR_1B_BLOCK_ITERATE when reporting
  	problems rather than using com_err directly.
  problem.c, problem.h (PR_1B_BLOCK_ITERATE): Add new problem code.
  message.c (expand_percent_expression): Add safety check.  If ctx->str
  	is NULL, print "NULL" instead of dereferencing the null pointer.
  pass1b.c, pass2.c, pass3.c: Change calls to ext2fs_block_iterate to
  	ext2fs_block_iterate2, to support 64-bit filesizes and to speed things
  	up slightly by avoiding the use of the ext2fs_block_iterate's
  	compatibility shim layer.
version.h:
  Update for WIP release.

diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 07c24e7..5b2b557 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,19 @@
+2000-11-16  Theodore Ts'o  <tytso@valinux.com>
+
+	* pass1b.c: Change routines to use PR_1B_BLOCK_ITERATE when
+		reporting problems rather than using com_err directly.
+
+	* problem.c, problem.h (PR_1B_BLOCK_ITERATE): Add new problem code.
+
+	* message.c (expand_percent_expression): Add safety check.  If
+		ctx->str is NULL, print "NULL" instead of dereferencing
+		the null pointer.
+
+	* pass1b.c, pass2.c, pass3.c: Change calls to ext2fs_block_iterate
+		to ext2fs_block_iterate2, to support 64-bit filesizes and
+		to speed things up slightly by avoiding the use of the
+		ext2fs_block_iterate's compatibility shim layer.
+
 2000-10-30    <tytso@snap.thunk.org>
 
 	* util.c (get_backup_sb): Calculate backup superblock correctly
diff --git a/e2fsck/message.c b/e2fsck/message.c
index 3449999..aaff03c 100644
--- a/e2fsck/message.c
+++ b/e2fsck/message.c
@@ -389,7 +389,7 @@
 		printf("%d", get_backup_sb(fs));
 		break;
 	case 's':
-		printf("%s", ctx->str);
+		printf("%s", ctx->str ? ctx->str : "NULL");
 		break;
 	case 'X':
 #ifdef EXT2_NO_64_TYPE
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index 5db39ab..b7d9330 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -88,7 +88,8 @@
 };
 
 static int process_pass1b_block(ext2_filsys fs, blk_t	*blocknr,
-				int	blockcnt, void	*priv_data);
+				e2_blkcnt_t blockcnt, blk_t ref_blk, 
+				int ref_offset, void *priv_data);
 static void delete_file(e2fsck_t ctx, struct dup_inode *dp,
 			char *block_buf);
 static int clone_file(e2fsck_t ctx, struct dup_inode *dp, char* block_buf);
@@ -187,6 +188,7 @@
 	ctx->stashed_inode = &inode;
 	pb.ctx = ctx;
 	pb.pctx = &pctx;
+	pctx.str = "pass1b";
 	while (ino) {
 		pctx.ino = ctx->stashed_ino = ino;
 		if ((ino != EXT2_BAD_INO) &&
@@ -196,7 +198,7 @@
 
 		pb.ino = ino;
 		pb.dup_blocks = 0;
-		retval = ext2fs_block_iterate(fs, ino, 0, block_buf,
+		pctx.errcode = ext2fs_block_iterate2(fs, ino, 0, block_buf,
 					      process_pass1b_block, &pb);
 		if (pb.dup_blocks) {
 			end_problem_latch(ctx, PR_LATCH_DBLOCK);
@@ -212,10 +214,8 @@
 			if (ino != EXT2_BAD_INO)
 				dup_inode_count++;
 		}
-		if (retval)
-			com_err(ctx->program_name, retval,
-			    _("while calling ext2fs_block_iterate in pass1b"));
-		
+		if (pctx.errcode)
+			fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
 	next:
 		pctx.errcode = ext2fs_get_next_inode(scan, &ino, &inode);
 		if (pctx.errcode == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE)
@@ -233,7 +233,9 @@
 
 int process_pass1b_block(ext2_filsys fs,
 			 blk_t	*block_nr,
-			 int blockcnt,
+			 e2_blkcnt_t blockcnt,
+			 blk_t ref_blk, 
+			 int ref_offset, 			 
 			 void *priv_data)
 {
 	struct process_block_struct *p;
@@ -483,7 +485,9 @@
 
 static int delete_file_block(ext2_filsys fs,
 			     blk_t	*block_nr,
-			     int blockcnt,
+			     e2_blkcnt_t blockcnt,
+			     blk_t ref_block,
+			     int ref_offset, 
 			     void *priv_data)
 {
 	struct process_block_struct *pb;
@@ -523,17 +527,18 @@
 	errcode_t	retval;
 	struct process_block_struct pb;
 	struct ext2_inode	inode;
+	struct problem_context	pctx;
 
-	pb.ino = dp->ino;
+	clear_problem_context(&pctx);
+	pctx.ino = pb.ino = dp->ino;
 	pb.dup_blocks = dp->num_dupblocks;
 	pb.ctx = ctx;
-	
-	retval = ext2fs_block_iterate(fs, dp->ino, 0, block_buf,
-				      delete_file_block, &pb);
-	if (retval)
-		com_err("delete_file", retval,
-			_("while calling ext2fs_block_iterate for inode %d"),
-			dp->ino);
+	pctx.str = "delete_file";
+
+	pctx.errcode = ext2fs_block_iterate2(fs, dp->ino, 0, block_buf,
+				       delete_file_block, &pb);
+	if (pctx.errcode)
+		fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
 	ext2fs_unmark_inode_bitmap(ctx->inode_used_map, dp->ino);
 	ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, dp->ino);
 	if (ctx->inode_bad_map)
@@ -556,7 +561,9 @@
 
 static int clone_file_block(ext2_filsys fs,
 			    blk_t	*block_nr,
-			    int blockcnt,
+			    e2_blkcnt_t blockcnt,
+			    blk_t ref_block,
+			    int ref_offset, 
 			    void *priv_data)
 {
 	struct dup_block *p;
@@ -624,7 +631,9 @@
 	ext2_filsys fs = ctx->fs;
 	errcode_t	retval;
 	struct clone_struct cs;
+	struct problem_context	pctx;
 
+	clear_problem_context(&pctx);
 	cs.errcode = 0;
 	cs.dir = 0;
 	cs.ctx = ctx;
@@ -634,21 +643,21 @@
 
 	if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, dp->ino))
 		cs.dir = dp->ino;
-	
-	retval = ext2fs_block_iterate(fs, dp->ino, 0, block_buf,
+
+	pctx.ino = dp->ino;
+	pctx.str = "clone_file";
+	pctx.errcode = ext2fs_block_iterate2(fs, dp->ino, 0, block_buf,
 				      clone_file_block, &cs);
 	ext2fs_mark_bb_dirty(fs);
 	ext2fs_free_mem((void **) &cs.buf);
-	if (retval) {
-		com_err("clone_file", retval,
-			_("while calling ext2fs_block_iterate for inode %d"),
-			dp->ino);
-		return retval;
+	if (pctx.errcode) {
+		fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
+		return pctx.errcode;
 	}
 	if (cs.errcode) {
 		com_err("clone_file", cs.errcode,
 			_("returned from clone_file_block"));
-		return retval;
+		return cs.errcode;
 	}
 	return 0;
 }
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 6b95900..0aca7cc 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -63,7 +63,9 @@
 			      char *buf, struct problem_context *pctx);
 static int update_dir_block(ext2_filsys fs,
 			    blk_t	*block_nr,
-			    int blockcnt,
+			    e2_blkcnt_t blockcnt,
+			    blk_t ref_block,
+			    int ref_offset, 
 			    void *priv_data);
 
 struct check_dir_struct {
@@ -599,9 +601,11 @@
  * functioned called by deallocate inode via ext2fs_iterate_block().
  */
 static int deallocate_inode_block(ext2_filsys fs,
-			     blk_t	*block_nr,
-			     int blockcnt,
-			     void *priv_data)
+				  blk_t	*block_nr,
+				  e2_blkcnt_t blockcnt,
+				  blk_t ref_block,
+				  int ref_offset, 
+				  void *priv_data)
 {
 	e2fsck_t	ctx = (e2fsck_t) priv_data;
 	
@@ -645,7 +649,7 @@
 		return;
 	
 	ext2fs_mark_bb_dirty(fs);
-	pctx.errcode = ext2fs_block_iterate(fs, ino, 0, block_buf,
+	pctx.errcode = ext2fs_block_iterate2(fs, ino, 0, block_buf,
 					    deallocate_inode_block, ctx);
 	if (pctx.errcode) {
 		fix_problem(ctx, PR_2_DEALLOC_INODE, &pctx);
@@ -831,7 +835,7 @@
 	 * Finally, update the block pointers for the inode
 	 */
 	db->blk = blk;
-	pctx->errcode = ext2fs_block_iterate(fs, db->ino, BLOCK_FLAG_HOLE,
+	pctx->errcode = ext2fs_block_iterate2(fs, db->ino, BLOCK_FLAG_HOLE,
 				      0, update_dir_block, db);
 	if (pctx->errcode) {
 		pctx->str = "ext2fs_block_iterate";
@@ -847,13 +851,15 @@
  */
 static int update_dir_block(ext2_filsys fs,
 			    blk_t	*block_nr,
-			    int blockcnt,
+			    e2_blkcnt_t blockcnt,
+			    blk_t ref_block,
+			    int ref_offset, 
 			    void *priv_data)
 {
 	struct ext2_db_entry *db;
 
 	db = (struct ext2_db_entry *) priv_data;
-	if (db->blockcnt == blockcnt) {
+	if (db->blockcnt == (int) blockcnt) {
 		*block_nr = db->blk;
 		return BLOCK_CHANGED;
 	}
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 9344e55..695e3b8 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -680,7 +680,9 @@
 
 static int expand_dir_proc(ext2_filsys fs,
 			   blk_t	*blocknr,
-			   int	blockcnt,
+			   e2_blkcnt_t	blockcnt,
+			   blk_t ref_block,
+			   int ref_offset, 
 			   void	*priv_data)
 {
 	struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
@@ -761,8 +763,8 @@
 	es.newblocks = 0;
 	es.ctx = ctx;
 	
-	retval = ext2fs_block_iterate(fs, dir, BLOCK_FLAG_APPEND,
-				      0, expand_dir_proc, &es);
+	retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND,
+				       0, expand_dir_proc, &es);
 
 	if (es.err)
 		return es.err;
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index df87beb..1141eda 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -470,7 +470,7 @@
 
 	/* Error while iterating over blocks */
 	{ PR_1_BLOCK_ITERATE,
-	  N_("Error while iterating over blocks in @i %i: %m\n"),
+	  N_("Error while iterating over @bs in @i %i: %m\n"),
 	  PROMPT_NONE, PR_FATAL },
 
 	/* Error while storing inode count information */	  
@@ -551,7 +551,11 @@
 	  N_("@A @i @B (inode_dup_map): %m\n"),
 	  PROMPT_NONE, PR_FATAL },
 
-
+	/* Error while iterating over blocks */
+	{ PR_1B_BLOCK_ITERATE,
+	  N_("Error while iterating over @bs in @i %i (%s): %m\n"),
+	  PROMPT_NONE, 0 },
+		  
 	/* Pass 1C: Scan directories for inodes with dup blocks. */
 	{ PR_1C_PASS_HEADER,
 	  N_("Pass 1C: Scan directories for @is with dup @bs.\n"),
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index b432e64..d92dd33 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -321,7 +321,10 @@
 /* Error allocating inode bitmap */
 #define PR_1B_ALLOCATE_IBITMAP_ERROR 0x011005
 
+/* Error while iterating over blocks */
+#define PR_1B_BLOCK_ITERATE	0x0110006
 
+	
 /* Pass 1C: Scan directories for inodes with dup blocks. */
 #define PR_1C_PASS_HEADER	0x012000
 
diff --git a/version.h b/version.h
index b41cf99..0c7ac19 100644
--- a/version.h
+++ b/version.h
@@ -7,4 +7,4 @@
  */
 
 #define E2FSPROGS_VERSION "1.20-WIP"
-#define E2FSPROGS_DATE "24-Oct-2000"
+#define E2FSPROGS_DATE "16-Nov-2000"