Re: [RFC][E2FSPROGS][PATCH 3/8]

Alexandre Ratchov <[email protected]>
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
Change some unsigned int, unsigned long, etc to blk_t. At this stage
its size is still 32bit. But in the following patches it becomes
64bit wide while pblk_t stays 32bit.



Index: e2fsprogs/resize/resize2fs.c
===================================================================
--- e2fsprogs.orig/resize/resize2fs.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/resize/resize2fs.c	2006-05-24 15:30:20.000000000 +0200
@@ -539,7 +539,7 @@
 				   ext2fs_block_bitmap bmap)
 {
 	blk_t			block, b;
-	unsigned int		j;
+	blk_t			j;
 	dgrp_t			i;
 	unsigned long		meta_bg_size;
 	unsigned int		old_desc_blocks;
Index: e2fsprogs/lib/e2p/parse_num.c
===================================================================
--- e2fsprogs.orig/lib/e2p/parse_num.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/e2p/parse_num.c	2006-05-24 15:30:20.000000000 +0200
@@ -11,7 +11,7 @@
 
 #include <stdlib.h>
 
-unsigned long parse_num_blocks(const char *arg, int log_block_size)
+unsigned long long parse_num_blocks(const char *arg, int log_block_size)
 {
 	char *p;
 	unsigned long long num;
Index: e2fsprogs/ext2ed/ext2ed.h
===================================================================
--- e2fsprogs.orig/ext2ed/ext2ed.h	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/ext2ed/ext2ed.h	2006-05-24 15:30:20.000000000 +0200
@@ -202,7 +202,7 @@
 extern char device_name [80];
 extern char last_command_line [80];
 extern FILE *device_handle;
-extern long device_offset;
+extern blk_t device_offset;
 extern int  mounted;
 
 extern short block_size;
Index: e2fsprogs/lib/ext2fs/bitops.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/bitops.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/bitops.c	2006-05-24 15:30:20.000000000 +0200
@@ -30,7 +30,7 @@
  * systems, as well as non-32 bit systems.
  */
 
-int ext2fs_set_bit(unsigned int nr,void * addr)
+int ext2fs_set_bit(blk_t nr,void * addr)
 {
 	int		mask, retval;
 	unsigned char	*ADDR = (unsigned char *) addr;
@@ -42,7 +42,7 @@
 	return retval;
 }
 
-int ext2fs_clear_bit(unsigned int nr, void * addr)
+int ext2fs_clear_bit(blk_t nr, void * addr)
 {
 	int		mask, retval;
 	unsigned char	*ADDR = (unsigned char *) addr;
@@ -54,7 +54,7 @@
 	return retval;
 }
 
-int ext2fs_test_bit(unsigned int nr, const void * addr)
+int ext2fs_test_bit(blk_t nr, const void * addr)
 {
 	int			mask;
 	const unsigned char	*ADDR = (const unsigned char *) addr;
Index: e2fsprogs/misc/mke2fs.c
===================================================================
--- e2fsprogs.orig/misc/mke2fs.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/misc/mke2fs.c	2006-05-24 15:30:20.000000000 +0200
@@ -676,9 +676,9 @@
 		s->s_log_block_size);
 	printf(_("Fragment size=%u (log=%u)\n"), fs->fragsize,
 		s->s_log_frag_size);
-	printf(_("%u inodes, %u blocks\n"), s->s_inodes_count,
+	printf(_("%u inodes, %lu blocks\n"), s->s_inodes_count,
 	       s->s_blocks_count);
-	printf(_("%u blocks (%2.2f%%) reserved for the super user\n"),
+	printf(_("%lu blocks (%2.2f%%) reserved for the super user\n"),
 		s->s_r_blocks_count,
 	       100.0 * s->s_r_blocks_count / s->s_blocks_count);
 	printf(_("First data block=%u\n"), s->s_first_data_block);
@@ -686,7 +686,7 @@
 		printf(_("Maximum filesystem blocks=%lu\n"),
 		       (s->s_reserved_gdt_blocks + fs->desc_blocks) *
 		       (fs->blocksize / sizeof(struct ext2_group_desc)) *
-		       s->s_blocks_per_group);
+		       (blk_t)s->s_blocks_per_group);
 	if (fs->group_desc_count > 1)
 		printf(_("%u block groups\n"), fs->group_desc_count);
 	else
@@ -715,7 +715,7 @@
 			col_left = 72;
 		}
 		col_left -= need;
-		printf("%u", group_block);
+		printf("%lu", group_block);
 	}
 	printf("\n\n");
 }
@@ -1400,13 +1400,6 @@
 		}
 	}
 
-	if (!force && fs_param.s_blocks_count >= (1 << 31)) {
-		com_err(program_name, 0,
-			_("Filesystem too large.  No more than 2**31-1 blocks\n"
-			  "\t (8TB using a blocksize of 4k) are currently supported."));
-             exit(1);
-	}
-
 	if ((blocksize > 4096) &&
 	    (fs_param.s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL))
 		fprintf(stderr, _("\nWarning: some 2.4 kernels do not support "
Index: e2fsprogs/lib/ext2fs/ext2_fs.h
===================================================================
--- e2fsprogs.orig/lib/ext2fs/ext2_fs.h	2006-05-24 15:30:10.000000000 +0200
+++ e2fsprogs/lib/ext2fs/ext2_fs.h	2006-05-24 15:30:20.000000000 +0200
@@ -192,7 +192,7 @@
 /*
  * Macro-instructions used to manage group descriptors
  */
-#define EXT2_BLOCKS_PER_GROUP(s)	(EXT2_SB(s)->s_blocks_per_group)
+#define EXT2_BLOCKS_PER_GROUP(s)	((blk_t)EXT2_SB(s)->s_blocks_per_group)
 #define EXT2_INODES_PER_GROUP(s)	(EXT2_SB(s)->s_inodes_per_group)
 #define EXT2_INODES_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
 /* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
Index: e2fsprogs/debugfs/logdump.c
===================================================================
--- e2fsprogs.orig/debugfs/logdump.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/debugfs/logdump.c	2006-05-24 15:30:20.000000000 +0200
@@ -36,11 +36,13 @@
 
 enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL};
 
-#define ANY_BLOCK ((unsigned int) -1)
+#define ANY_BLOCK ((blk_t) -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;
+blk_t		block_to_dump, bitmap_to_dump;
+unsigned int	group_to_dump;
+blk_t		inode_block_to_dump;
+unsigned int	inode_offset_to_dump;
 ext2_ino_t	inode_to_dump;
 
 struct journal_source 
@@ -364,8 +366,8 @@
 		if (dump_all) {
 			fprintf(out_file, "\tuuid=%s\n", jsb_buffer);
 			fprintf(out_file, "\tblocksize=%d\n", blocksize);
-			fprintf(out_file, "\tjournal data size %ld\n",
-				(long) sb->s_blocks_count);
+			fprintf(out_file, "\tjournal data size %lu\n",
+				(unsigned long) sb->s_blocks_count);
 		}
 	}
 	
Index: e2fsprogs/lib/ext2fs/bitops.h
===================================================================
--- e2fsprogs.orig/lib/ext2fs/bitops.h	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/bitops.h	2006-05-24 15:30:20.000000000 +0200
@@ -14,11 +14,11 @@
  */
 
 
-extern int ext2fs_set_bit(unsigned int nr,void * addr);
-extern int ext2fs_clear_bit(unsigned int nr, void * addr);
-extern int ext2fs_test_bit(unsigned int nr, const void * addr);
-extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
-extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
+extern int ext2fs_set_bit(blk_t nr,void * addr);
+extern int ext2fs_clear_bit(blk_t nr, void * addr);
+extern int ext2fs_test_bit(blk_t nr, const void * addr);
+extern void ext2fs_fast_set_bit(blk_t nr,void * addr);
+extern void ext2fs_fast_clear_bit(blk_t nr, void * addr);
 extern __u16 ext2fs_swab16(__u16 val);
 extern __u32 ext2fs_swab32(__u32 val);
 
@@ -101,7 +101,7 @@
 
 /* These two routines moved to gen_bitmap.c */
 extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
-					 __u32 bitno);
+					 blk_t bitno);
 extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
 					   blk_t bitno);
 /*
@@ -175,7 +175,7 @@
 #define EXT2FS_ADDR (*(struct __dummy_h *) addr)
 #define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)	
 
-_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
+_INLINE_ int ext2fs_set_bit(blk_t nr, void * addr)
 {
 	int oldbit;
 
@@ -186,7 +186,7 @@
 	return oldbit;
 }
 
-_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
+_INLINE_ int ext2fs_clear_bit(blk_t nr, void * addr)
 {
 	int oldbit;
 
@@ -197,7 +197,7 @@
 	return oldbit;
 }
 
-_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
+_INLINE_ int ext2fs_test_bit(blk_t nr, const void * addr)
 {
 	int oldbit;
 
@@ -295,7 +295,7 @@
 
 #define _EXT2_HAVE_ASM_BITOPS_
 
-_INLINE_ int ext2fs_set_bit(unsigned int nr,void * addr)
+_INLINE_ int ext2fs_set_bit(blk_t nr,void * addr)
 {
 	char retval;
 
@@ -305,7 +305,7 @@
 	return retval;
 }
 
-_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
+_INLINE_ int ext2fs_clear_bit(blk_t nr, void * addr)
 {
 	char retval;
 
@@ -315,7 +315,7 @@
 	return retval;
 }
 
-_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
+_INLINE_ int ext2fs_test_bit(blk_t nr, const void * addr)
 {
 	char retval;
 
Index: e2fsprogs/lib/ext2fs/bitmaps.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/bitmaps.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/bitmaps.c	2006-05-24 15:30:20.000000000 +0200
@@ -27,7 +27,7 @@
 #include "ext2_fs.h"
 #include "ext2fs.h"
 
-static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end,
+static errcode_t make_bitmap(blk_t start, blk_t end, blk_t real_end,
 			     const char *descr, char *init_map,
 			     ext2fs_generic_bitmap *ret)
 {
@@ -72,9 +72,9 @@
 	return 0;
 }
 
-errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
-					 __u32 end,
-					 __u32 real_end,
+errcode_t ext2fs_allocate_generic_bitmap(blk_t start,
+					 blk_t end,
+					 blk_t real_end,
 					 const char *descr,
 					 ext2fs_generic_bitmap *ret)
 {
@@ -100,7 +100,7 @@
 
 void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map)
 {
-	__u32	i, j;
+	blk_t	i, j;
 
 	for (i=map->end+1, j = i - map->start; i <= map->real_end; i++, j++)
 		ext2fs_set_bit(j, map->bitmap);
@@ -143,7 +143,7 @@
 {
 	ext2fs_block_bitmap bitmap;
 	errcode_t	retval;
-	__u32		start, end, real_end;
+	blk_t		start, end, real_end;
 
 	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
Index: e2fsprogs/lib/ext2fs/badblocks.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/badblocks.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/lib/ext2fs/badblocks.c	2006-05-24 15:30:20.000000000 +0200
@@ -282,8 +282,13 @@
 
 int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, blk_t *blk)
 {
-	return ext2fs_u32_list_iterate((ext2_u32_iterate) iter,
-				       (__u32 *) blk);
+	int ret;
+	__u32 b = *blk;
+
+	ret = ext2fs_u32_list_iterate((ext2_u32_iterate) iter,
+				       &b);
+	*blk = b;
+	return ret;
 }
 
 
Index: e2fsprogs/lib/e2p/e2p.h
===================================================================
--- e2fsprogs.orig/lib/e2p/e2p.h	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/e2p/e2p.h	2006-05-24 15:30:20.000000000 +0200
@@ -46,7 +46,7 @@
 int e2p_string2mntopt(char *string, unsigned int *mask);
 int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok);
 
-unsigned long parse_num_blocks(const char *arg, int log_block_size);
+unsigned long long parse_num_blocks(const char *arg, int log_block_size);
 
 char *e2p_os2string(int os_type);
 int e2p_string2os(char *str);
Index: e2fsprogs/e2fsck/pass1b.c
===================================================================
--- e2fsprogs.orig/e2fsck/pass1b.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/e2fsck/pass1b.c	2006-05-24 15:30:20.000000000 +0200
@@ -289,9 +289,12 @@
 		    (ino == EXT2_BAD_INO))
 			pctx.errcode = ext2fs_block_iterate2(fs, ino,
 				     0, block_buf, process_pass1b_block, &pb);
-		if (inode.i_file_acl)
-			process_pass1b_block(fs, &inode.i_file_acl,
+		if (inode.i_file_acl) {
+			blk_t i_file_acl = inode.i_file_acl;
+			process_pass1b_block(fs, &i_file_acl,
 					     BLOCK_COUNT_EXTATTR, 0, 0, &pb);
+			inode.i_file_acl = i_file_acl;
+		}
 		if (pb.dup_blocks) {
 			end_problem_latch(ctx, PR_LATCH_DBLOCK);
 			if (ino >= EXT2_FIRST_INODE(fs->super) ||
@@ -617,9 +620,12 @@
 		 */
 		if ((count == 0) ||
 		    ext2fs_test_block_bitmap(ctx->block_dup_map,
-					     inode.i_file_acl)) 
-			delete_file_block(fs, &inode.i_file_acl,
+					     inode.i_file_acl)) {
+			blk_t i_file_acl = inode.i_file_acl;
+			delete_file_block(fs, &i_file_acl,
 					  BLOCK_COUNT_EXTATTR, 0, 0, &pb);
+			inode.i_file_acl = i_file_acl;
+		}
 	}
 	e2fsck_write_inode(ctx, ino, &inode, "delete_file");
 }
@@ -706,10 +712,12 @@
 	struct clone_struct cs;
 	struct problem_context	pctx;
 	blk_t		blk;
+	blk_t		i_file_acl;
 	dnode_t		*n;
 	struct inode_el	*ino_el;
 	struct dup_block	*db;
 	struct dup_inode	*di;
+	int ret;
 
 	clear_problem_context(&pctx);
 	cs.errcode = 0;
@@ -742,9 +750,10 @@
 	/* The inode may have changed on disk, so we have to re-read it */
 	e2fsck_read_inode(ctx, ino, &dp->inode, "clone file EA");
 	blk = dp->inode.i_file_acl;
-	if (blk && (clone_file_block(fs, &dp->inode.i_file_acl,
-				     BLOCK_COUNT_EXTATTR, 0, 0, &cs) ==
-		    BLOCK_CHANGED)) {
+	i_file_acl = dp->inode.i_file_acl;
+	ret = clone_file_block(fs, &i_file_acl, BLOCK_COUNT_EXTATTR, 0, 0, &cs);
+	dp->inode.i_file_acl = i_file_acl;
+	if (blk && (ret == BLOCK_CHANGED)) {
 		e2fsck_write_inode(ctx, ino, &dp->inode, "clone file EA");
 		/*
 		 * If we cloned the EA block, find all other inodes
Index: e2fsprogs/lib/ext2fs/unix_io.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/unix_io.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/unix_io.c	2006-05-24 15:30:20.000000000 +0200
@@ -75,9 +75,9 @@
 static errcode_t unix_open(const char *name, int flags, io_channel *channel);
 static errcode_t unix_close(io_channel channel);
 static errcode_t unix_set_blksize(io_channel channel, int blksize);
-static errcode_t unix_read_blk(io_channel channel, unsigned long block,
+static errcode_t unix_read_blk(io_channel channel, unsigned long long block,
 			       int count, void *data);
-static errcode_t unix_write_blk(io_channel channel, unsigned long block,
+static errcode_t unix_write_blk(io_channel channel, unsigned long long block,
 				int count, const void *data);
 static errcode_t unix_flush(io_channel channel);
 static errcode_t unix_write_byte(io_channel channel, unsigned long offset,
@@ -522,7 +522,7 @@
 }
 
 
-static errcode_t unix_read_blk(io_channel channel, unsigned long block,
+static errcode_t unix_read_blk(io_channel channel, unsigned long long block,
 			       int count, void *buf)
 {
 	struct unix_private_data *data;
@@ -587,7 +587,7 @@
 #endif /* NO_IO_CACHE */
 }
 
-static errcode_t unix_write_blk(io_channel channel, unsigned long block,
+static errcode_t unix_write_blk(io_channel channel, unsigned long long block,
 				int count, const void *buf)
 {
 	struct unix_private_data *data;
Index: e2fsprogs/e2fsck/recovery.c
===================================================================
--- e2fsprogs.orig/e2fsck/recovery.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/e2fsck/recovery.c	2006-05-24 15:30:20.000000000 +0200
@@ -70,7 +70,7 @@
 {
 	int err;
 	unsigned int max, nbufs, next;
-	unsigned long blocknr;
+	blk_t blocknr;
 	struct buffer_head *bh;
 	
 	struct buffer_head * bufs[MAXBUF];
@@ -132,7 +132,7 @@
 		 unsigned int offset)
 {
 	int err;
-	unsigned long blocknr;
+	blk_t blocknr;
 	struct buffer_head *bh;
 
 	*bhp = NULL;
Index: e2fsprogs/lib/ext2fs/inode_io.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/inode_io.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/inode_io.c	2006-05-24 15:30:20.000000000 +0200
@@ -49,9 +49,9 @@
 static errcode_t inode_open(const char *name, int flags, io_channel *channel);
 static errcode_t inode_close(io_channel channel);
 static errcode_t inode_set_blksize(io_channel channel, int blksize);
-static errcode_t inode_read_blk(io_channel channel, unsigned long block,
+static errcode_t inode_read_blk(io_channel channel, unsigned long long block,
 			       int count, void *data);
-static errcode_t inode_write_blk(io_channel channel, unsigned long block,
+static errcode_t inode_write_blk(io_channel channel, unsigned long long block,
 				int count, const void *data);
 static errcode_t inode_flush(io_channel channel);
 static errcode_t inode_write_byte(io_channel channel, unsigned long offset,
@@ -197,7 +197,7 @@
 }
 
 
-static errcode_t inode_read_blk(io_channel channel, unsigned long block,
+static errcode_t inode_read_blk(io_channel channel, unsigned long long block,
 			       int count, void *buf)
 {
 	struct inode_private_data *data;
@@ -217,7 +217,7 @@
 	return ext2fs_file_read(data->file, buf, count, 0);
 }
 
-static errcode_t inode_write_blk(io_channel channel, unsigned long block,
+static errcode_t inode_write_blk(io_channel channel, unsigned long long block,
 				int count, const void *buf)
 {
 	struct inode_private_data *data;
Index: e2fsprogs/lib/ext2fs/initialize.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/initialize.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/initialize.c	2006-05-24 15:30:20.000000000 +0200
@@ -233,7 +233,7 @@
 	 * should be.  But make sure that we don't allocate more than
 	 * one bitmap's worth of inodes each group.
 	 */
-	ipg = (super->s_inodes_count + fs->group_desc_count - 1) /
+	ipg = ((blk_t)super->s_inodes_count + (blk_t)fs->group_desc_count - 1) /
 		fs->group_desc_count;
 	if (ipg > fs->blocksize * 8) {
 		if (super->s_blocks_per_group >= 256) {
Index: e2fsprogs/lib/ext2fs/ext2_io.h
===================================================================
--- e2fsprogs.orig/lib/ext2fs/ext2_io.h	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/ext2_io.h	2006-05-24 15:30:20.000000000 +0200
@@ -35,14 +35,14 @@
 	char		*name;
 	int		block_size;
 	errcode_t	(*read_error)(io_channel channel,
-				      unsigned long block,
+				      unsigned long long block,
 				      int count,
 				      void *data,
 				      size_t size,
 				      int actual_bytes_read,
 				      errcode_t	error);
 	errcode_t	(*write_error)(io_channel channel,
-				       unsigned long block,
+				       unsigned long long block,
 				       int count,
 				       const void *data,
 				       size_t size,
@@ -61,9 +61,9 @@
 	errcode_t (*open)(const char *name, int flags, io_channel *channel);
 	errcode_t (*close)(io_channel channel);
 	errcode_t (*set_blksize)(io_channel channel, int blksize);
-	errcode_t (*read_blk)(io_channel channel, unsigned long block,
+	errcode_t (*read_blk)(io_channel channel, unsigned long long block,
 			      int count, void *data);
-	errcode_t (*write_blk)(io_channel channel, unsigned long block,
+	errcode_t (*write_blk)(io_channel channel, unsigned long long block,
 			       int count, const void *data);
 	errcode_t (*flush)(io_channel channel);
 	errcode_t (*write_byte)(io_channel channel, unsigned long offset,
@@ -99,9 +99,9 @@
 /* test_io.c */
 extern io_manager test_io_manager, test_io_backing_manager;
 extern void (*test_io_cb_read_blk)
-	(unsigned long block, int count, errcode_t err);
+	(unsigned long long block, int count, errcode_t err);
 extern void (*test_io_cb_write_blk)
-	(unsigned long block, int count, errcode_t err);
+	(unsigned long long block, int count, errcode_t err);
 extern void (*test_io_cb_set_blksize)
 	(int blksize, errcode_t err);
 
Index: e2fsprogs/lib/ext2fs/test_io.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/test_io.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/test_io.c	2006-05-24 15:30:20.000000000 +0200
@@ -48,8 +48,8 @@
 	FILE *outfile;
 	unsigned long block;
 	int read_abort_count, write_abort_count;
-	void (*read_blk)(unsigned long block, int count, errcode_t err);
-	void (*write_blk)(unsigned long block, int count, errcode_t err);
+	void (*read_blk)(unsigned long long block, int count, errcode_t err);
+	void (*write_blk)(unsigned long long block, int count, errcode_t err);
 	void (*set_blksize)(int blksize, errcode_t err);
 	void (*write_byte)(unsigned long block, int count, errcode_t err);
 };
@@ -57,9 +57,9 @@
 static errcode_t test_open(const char *name, int flags, io_channel *channel);
 static errcode_t test_close(io_channel channel);
 static errcode_t test_set_blksize(io_channel channel, int blksize);
-static errcode_t test_read_blk(io_channel channel, unsigned long block,
+static errcode_t test_read_blk(io_channel channel, unsigned long long block,
 			       int count, void *data);
-static errcode_t test_write_blk(io_channel channel, unsigned long block,
+static errcode_t test_write_blk(io_channel channel, unsigned long long block,
 				int count, const void *data);
 static errcode_t test_flush(io_channel channel);
 static errcode_t test_write_byte(io_channel channel, unsigned long offset,
@@ -88,9 +88,9 @@
  */
 io_manager test_io_backing_manager = 0;
 void (*test_io_cb_read_blk)
-	(unsigned long block, int count, errcode_t err) = 0;
+	(unsigned long long block, int count, errcode_t err) = 0;
 void (*test_io_cb_write_blk)
-	(unsigned long block, int count, errcode_t err) = 0;
+	(unsigned long long block, int count, errcode_t err) = 0;
 void (*test_io_cb_set_blksize)
 	(int blksize, errcode_t err) = 0;
 void (*test_io_cb_write_byte)
@@ -286,7 +286,7 @@
 }
 
 
-static errcode_t test_read_blk(io_channel channel, unsigned long block,
+static errcode_t test_read_blk(io_channel channel, unsigned long long block,
 			       int count, void *buf)
 {
 	struct test_private_data *data;
@@ -313,7 +313,7 @@
 	return retval;
 }
 
-static errcode_t test_write_blk(io_channel channel, unsigned long block,
+static errcode_t test_write_blk(io_channel channel, unsigned long long block,
 			       int count, const void *buf)
 {
 	struct test_private_data *data;
Index: e2fsprogs/ext2ed/blockbitmap_com.c
===================================================================
--- e2fsprogs.orig/ext2ed/blockbitmap_com.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/ext2ed/blockbitmap_com.c	2006-05-24 15:30:20.000000000 +0200
@@ -249,7 +249,7 @@
 	wprintw (show_win,"Block bitmap of block group %ld\n",block_bitmap_info.group_num);
 										/* Show the block number */
 										
-	block_num=block_bitmap_info.entry_num+block_bitmap_info.group_num*file_system_info.super_block.s_blocks_per_group;
+	block_num=block_bitmap_info.entry_num+block_bitmap_info.group_num*(blk_t)file_system_info.super_block.s_blocks_per_group;
 	block_num+=file_system_info.super_block.s_first_data_block;	
 
 	wprintw (show_win,"Status of block %ld - ",block_num);			/* and the allocation status */
Index: e2fsprogs/debugfs/set_fields.c
===================================================================
--- e2fsprogs.orig/debugfs/set_fields.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/debugfs/set_fields.c	2006-05-24 15:30:20.000000000 +0200
@@ -329,7 +329,7 @@
 static errcode_t parse_bmap(struct field_set_info *info, char *arg)
 {
 	unsigned long	num;
-	pblk_t		blk;
+	blk_t		blk;
 	errcode_t	retval;
 	char		*tmp;
 
Index: e2fsprogs/e2fsck/pass1.c
===================================================================
--- e2fsprogs.orig/e2fsck/pass1.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/e2fsck/pass1.c	2006-05-24 15:30:20.000000000 +0200
@@ -1537,7 +1537,7 @@
 		sprintf(problem, "< FIRSTBLOCK (%u)", super);
 		return(problem);
 	} else if (block >= fs->super->s_blocks_count) {
-		sprintf(problem, "> BLOCKS (%u)", fs->super->s_blocks_count);
+		sprintf(problem, "> BLOCKS (%lu)", fs->super->s_blocks_count);
 		return(problem);
 	}
 	for (i = 0; i < fs->group_desc_count; i++) {
@@ -1952,21 +1952,27 @@
 {
 	ext2_filsys fs = ctx->fs;
 	dgrp_t		i;
-	int		first_block = fs->super->s_first_data_block;
+	blk_t		first_block = fs->super->s_first_data_block;
 
 	for (i = 0; i < fs->group_desc_count; i++) {
 		if (ctx->invalid_block_bitmap_flag[i]) {
+			blk_t blk;
 			new_table_block(ctx, first_block, i, _("block bitmap"),
-					1, &fs->group_desc[i].bg_block_bitmap);
+					1, &blk);
+			fs->group_desc[i].bg_block_bitmap = blk;
 		}
 		if (ctx->invalid_inode_bitmap_flag[i]) {
+			blk_t blk;
 			new_table_block(ctx, first_block, i, _("inode bitmap"),
-					1, &fs->group_desc[i].bg_inode_bitmap);
+					1, &blk);
+			fs->group_desc[i].bg_inode_bitmap = blk;
 		}
 		if (ctx->invalid_inode_table_flag[i]) {
+			blk_t blk;
 			new_table_block(ctx, first_block, i, _("inode table"),
 					fs->inode_blocks_per_group, 
-					&fs->group_desc[i].bg_inode_table);
+					&blk);
+			fs->group_desc[i].bg_inode_table = blk;
 			ctx->flags |= E2F_FLAG_RESTART;
 		}
 		first_block += fs->super->s_blocks_per_group;
Index: e2fsprogs/lib/e2p/ls.c
===================================================================
--- e2fsprogs.orig/lib/e2p/ls.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/e2p/ls.c	2006-05-24 15:30:20.000000000 +0200
@@ -192,9 +192,9 @@
 	fprintf(f, "Filesystem OS type:       %s\n", str);
 	free(str);
 	fprintf(f, "Inode count:              %u\n", sb->s_inodes_count);
-	fprintf(f, "Block count:              %u\n", sb->s_blocks_count);
-	fprintf(f, "Reserved block count:     %u\n", sb->s_r_blocks_count);
-	fprintf(f, "Free blocks:              %u\n", sb->s_free_blocks_count);
+	fprintf(f, "Block count:              %lu\n", sb->s_blocks_count);
+	fprintf(f, "Reserved block count:     %lu\n", sb->s_r_blocks_count);
+	fprintf(f, "Free blocks:              %lu\n", sb->s_free_blocks_count);
 	fprintf(f, "Free inodes:              %u\n", sb->s_free_inodes_count);
 	fprintf(f, "First block:              %u\n", sb->s_first_data_block);
 	fprintf(f, "Block size:               %u\n", EXT2_BLOCK_SIZE(sb));
Index: e2fsprogs/e2fsck/super.c
===================================================================
--- e2fsprogs.orig/e2fsck/super.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/e2fsck/super.c	2006-05-24 15:30:20.000000000 +0200
@@ -23,8 +23,8 @@
 #define MAX_CHECK 2
 
 static void check_super_value(e2fsck_t ctx, const char *descr,
-			      unsigned long value, int flags,
-			      unsigned long min_val, unsigned long max_val)
+			      blk_t value, int flags,
+			      blk_t min_val, blk_t max_val)
 {
 	struct		problem_context pctx;
 
@@ -423,7 +423,7 @@
 		for (j = 1; j < fs->group_desc_count; j++) {
 			if (!ext2fs_bg_has_super(fs, j))
 				continue;
-			expect = pblk + (j * fs->super->s_blocks_per_group);
+			expect = pblk + (j * (blk_t)fs->super->s_blocks_per_group);
 			if (ind_buf[ind_off] != expect)
 				goto resize_inode_invalid;
 			ind_off++;
Index: e2fsprogs/debugfs/icheck.c
===================================================================
--- e2fsprogs.orig/debugfs/icheck.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/debugfs/icheck.c	2006-05-24 15:30:20.000000000 +0200
@@ -112,8 +112,10 @@
 		bw.inode = ino;
 
 		if (inode.i_file_acl) {
-			icheck_proc(current_fs, &inode.i_file_acl, 0,
+			blk_t i_file_acl;
+			icheck_proc(current_fs, &i_file_acl, 0,
 				    0, 0, &bw);
+			inode.i_file_acl = i_file_acl;
 			if (bw.blocks_left == 0)
 				break;
 		}
Index: e2fsprogs/lib/ext2fs/block.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/block.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/lib/ext2fs/block.c	2006-05-24 15:30:20.000000000 +0200
@@ -347,10 +347,12 @@
 			goto abort_exit;
 		got_inode = 1;
 		if (inode.osd1.hurd1.h_i_translator) {
+			blk_t h_i_translator = inode.osd1.hurd1.h_i_translator;
 			ret |= (*ctx.func)(fs,
-					   &inode.osd1.hurd1.h_i_translator,
+					   &h_i_translator,
 					   BLOCK_COUNT_TRANSLATOR,
 					   0, 0, priv_data);
+			inode.osd1.hurd1.h_i_translator = h_i_translator;
 			if (ret & BLOCK_ABORT)
 				goto abort_exit;
 		}
@@ -361,29 +363,38 @@
 	 */
 	for (i = 0; i < EXT2_NDIR_BLOCKS ; i++, ctx.bcount++) {
 		if (blocks[i] || (flags & BLOCK_FLAG_APPEND)) {
-			ret |= (*ctx.func)(fs, &blocks[i],
+			blk_t b = blocks[i];
+			ret |= (*ctx.func)(fs, &b,
 					    ctx.bcount, 0, i, priv_data);
+			blocks[i] = b;
 			if (ret & BLOCK_ABORT)
 				goto abort_exit;
 		}
 	}
 	if (*(blocks + EXT2_IND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
-		ret |= block_iterate_ind(blocks + EXT2_IND_BLOCK,
+		blk_t b;
+		b = *(blocks + EXT2_IND_BLOCK);
+		ret |= block_iterate_ind(&b,
 					 0, EXT2_IND_BLOCK, &ctx);
+		*(blocks + EXT2_IND_BLOCK) = b;
 		if (ret & BLOCK_ABORT)
 			goto abort_exit;
 	} else
 		ctx.bcount += limit;
 	if (*(blocks + EXT2_DIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
-		ret |= block_iterate_dind(blocks + EXT2_DIND_BLOCK,
+		blk_t b = *(blocks + EXT2_DIND_BLOCK);
+		ret |= block_iterate_dind(&b,
 					  0, EXT2_DIND_BLOCK, &ctx);
+		*(blocks + EXT2_DIND_BLOCK) = b;
 		if (ret & BLOCK_ABORT)
 			goto abort_exit;
 	} else
 		ctx.bcount += limit * limit;
 	if (*(blocks + EXT2_TIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
-		ret |= block_iterate_tind(blocks + EXT2_TIND_BLOCK,
+		blk_t b = *(blocks + EXT2_TIND_BLOCK);
+		ret |= block_iterate_tind(&b,
 					  0, EXT2_TIND_BLOCK, &ctx);
+		*(blocks + EXT2_TIND_BLOCK) = b;
 		if (ret & BLOCK_ABORT)
 			goto abort_exit;
 	}
Index: e2fsprogs/e2fsck/jfs_user.h
===================================================================
--- e2fsprogs.orig/e2fsck/jfs_user.h	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/e2fsck/jfs_user.h	2006-05-24 15:30:20.000000000 +0200
@@ -103,7 +103,7 @@
 /*
  * Kernel compatibility functions are defined in journal.c
  */
-int journal_bmap(journal_t *journal, blk_t block, unsigned long *phys);
+int journal_bmap(journal_t *journal, blk_t block, blk_t *phys);
 struct buffer_head *getblk(kdev_t ctx, blk_t blocknr, int blocksize);
 void sync_blockdev(kdev_t kdev);
 void ll_rw_block(int rw, int dummy, struct buffer_head *bh[]);
Index: e2fsprogs/ext2ed/inode_com.c
===================================================================
--- e2fsprogs.orig/ext2ed/inode_com.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/ext2ed/inode_com.c	2006-05-24 15:30:20.000000000 +0200
@@ -25,7 +25,8 @@
 
 	char *ptr,buffer [80];
 
-	long group_num,group_offset,entry_num,block_num,first_entry,last_entry;
+	blk_t block_num,group_offset;
+	long group_num,entry_num,first_entry,last_entry;
 	long inode_num,mult=1;
 	struct ext2_group_desc desc;
 
@@ -52,7 +53,7 @@
 		device_offset-=sizeof (struct ext2_inode)*mult;
 		entry_num-=mult;
 		
-		sprintf (buffer,"setoffset %ld",device_offset);dispatch (buffer);
+		sprintf (buffer,"setoffset %lu",device_offset);dispatch (buffer);
 		strcpy (buffer,"show");dispatch (buffer);
 	}
 
@@ -72,7 +73,8 @@
 
 	char *ptr,buffer [80];
 
-	long group_num,group_offset,entry_num,block_num,first_entry,last_entry;
+	blk_t group_offset,block_num;
+	long group_num,entry_num,first_entry,last_entry;
 	long inode_num,mult=1;
 	struct ext2_group_desc desc;
 
@@ -123,7 +125,8 @@
 	unsigned short temp;
 	int i;
 	
-	long group_num,group_offset,entry_num,block_num,first_entry,last_entry,inode_num;
+	blk_t group_offset,block_num;
+	long group_num,entry_num,first_entry,last_entry,inode_num;
 	struct ext2_group_desc desc;
 
 	block_num=device_offset/file_system_info.block_size;
@@ -284,7 +287,8 @@
 {
 	char *ptr,buffer [80];
 
-	long group_num,group_offset,entry_num,block_num,wanted_entry;
+	blk_t group_offset,block_num;
+	long group_num,entry_num,wanted_entry;
 	struct ext2_group_desc desc;
 
 	ptr=parse_word (command_line,buffer);
@@ -372,7 +376,8 @@
 	int found=0;
 	struct ext2_group_desc desc;
 	
-	long block_num,group_offset,group_num;
+	blk_t block_num,group_offset;
+	long group_num;
 	
 	block_num=inode_offset/file_system_info.block_size;
 
@@ -399,7 +404,8 @@
 long int inode_offset_to_inode_num (long inode_offset)
 
 {
-	long group_num,group_offset,entry_num,block_num,first_entry,last_entry,inode_num;
+	blk_t group_offset, block_num;
+	long group_num,entry_num,first_entry,last_entry,inode_num;
 	struct ext2_group_desc desc;
 
 	block_num=inode_offset/file_system_info.block_size;
@@ -409,7 +415,9 @@
 
 	low_read ((char *) &desc,sizeof (struct ext2_group_desc),group_offset);
 
-	entry_num=(inode_offset-desc.bg_inode_table*file_system_info.block_size)/sizeof (struct ext2_inode);
+	entry_num=((inode_offset-desc.bg_inode_table*file_system_info.block_size)/sizeof(struct ext2_inode);
+		file_system_info.block_size)/
+		sizeof (struct ext2_inode);
 	first_entry=0;last_entry=file_system_info.super_block.s_inodes_per_group-1;
 	inode_num=group_num*file_system_info.super_block.s_inodes_per_group+1;
 	inode_num+=entry_num;
@@ -420,7 +428,8 @@
 long int inode_num_to_inode_offset (long inode_num)
 
 {
-	long group_num,group_offset,inode_offset,inode_entry;
+	blk_t group_offset, inode_offset;
+	long group_num,inode_entry;
 	struct ext2_group_desc desc;
 
 	inode_num--;
Index: e2fsprogs/lib/ext2fs/gen_bitmap.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/gen_bitmap.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/gen_bitmap.c	2006-05-24 15:30:20.000000000 +0200
@@ -28,7 +28,7 @@
 #include "ext2fs.h"
 
 int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
-					 __u32 bitno)
+					 blk_t bitno)
 {
 	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
 		ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno);
Index: e2fsprogs/debugfs/util.c
===================================================================
--- e2fsprogs.orig/debugfs/util.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/debugfs/util.c	2006-05-24 15:30:20.000000000 +0200
@@ -238,16 +238,16 @@
 }
 
 /*
- * This function will convert a string to an unsigned long, printing
+ * This function will convert a string to an unsigned long long, printing
  * an error message if it fails, and returning success or failure in err.
  */
-unsigned long parse_ulong(const char *str, const char *cmd,
+unsigned long long parse_ullong(const char *str, const char *cmd,
 			  const char *descr, int *err)
 {
-	char		*tmp;
-	unsigned long	ret;
-	
-	ret = strtoul(str, &tmp, 0);
+	char			*tmp;
+	unsigned long long	ret;
+
+	ret = strtoull(str, &tmp, 0);
 	if (*tmp == 0) {
 		if (err)
 			*err = 0;
@@ -270,7 +270,7 @@
 	blk_t	blk;
 	int	err;
 
-	blk = parse_ulong(str, cmd, "block number", &err);
+	blk = parse_ullong(str, cmd, "block number", &err);
 	*ret = blk;
 	if (err == 0 && blk == 0) {
 		com_err(cmd, 0, "Invalid block number 0");
@@ -336,7 +336,7 @@
 	if (strtoblk(argv[0], argv[1], block))
 		return 1;
 	if (argc > 2) {
-		*count = parse_ulong(argv[2], argv[0], "count", &err);
+		*count = parse_ullong(argv[2], argv[0], "count", &err);
 		if (err)
 			return 1;
 	}
Index: e2fsprogs/lib/ext2fs/res_gdt.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/res_gdt.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/res_gdt.c	2006-05-24 15:30:20.000000000 +0200
@@ -166,7 +166,7 @@
 
 		while ((grp = list_backups(fs, &three, &five, &seven)) <
 		       fs->group_desc_count) {
-			blk_t expect = gdt_blk + grp * sb->s_blocks_per_group;
+			blk_t expect = gdt_blk + grp * (blk_t)sb->s_blocks_per_group;
 
 			if (!gdt_buf[last]) {
 #ifdef RES_GDT_DEBUG
Index: e2fsprogs/ext2ed/group_com.c
===================================================================
--- e2fsprogs.orig/ext2ed/group_com.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/ext2ed/group_com.c	2006-05-24 15:30:20.000000000 +0200
@@ -90,7 +90,7 @@
 
 	copy_num=atol (buffer);
 	
-	offset=file_system_info.first_group_desc_offset+copy_num*file_system_info.super_block.s_blocks_per_group*file_system_info.block_size;
+	offset=file_system_info.first_group_desc_offset+copy_num*(blk_t)file_system_info.super_block.s_blocks_per_group*file_system_info.block_size;
 	
 	if (offset > file_system_info.file_system_size) {
 		wprintw (command_win,"Error - Copy number out of bounds\n");refresh_command_win ();return;
@@ -134,39 +134,39 @@
 void type_ext2_group_desc___inode (char *command_line)
 
 {
-	long inode_offset;
+	blk_t inode_offset;
 	char buffer [80];
 	
 	inode_offset=type_data.u.t_ext2_group_desc.bg_inode_table;
-	sprintf (buffer,"setoffset block %ld",inode_offset);dispatch (buffer);
+	sprintf (buffer,"setoffset block %lu",inode_offset);dispatch (buffer);
 	sprintf (buffer,"settype ext2_inode");dispatch (buffer);
 }
 
 void type_ext2_group_desc___blockbitmap (char *command_line)
 
 {
-	long block_bitmap_offset;
+	blk_t block_bitmap_offset;
 	char buffer [80];
 	
 	block_bitmap_info.entry_num=0;
 	block_bitmap_info.group_num=group_info.group_num;
 	
 	block_bitmap_offset=type_data.u.t_ext2_group_desc.bg_block_bitmap;
-	sprintf (buffer,"setoffset block %ld",block_bitmap_offset);dispatch (buffer);
+	sprintf (buffer,"setoffset block %lu",block_bitmap_offset);dispatch (buffer);
 	sprintf (buffer,"settype block_bitmap");dispatch (buffer);
 }
 
 void type_ext2_group_desc___inodebitmap (char *command_line)
 
 {
-	long inode_bitmap_offset;
+	blk_t inode_bitmap_offset;
 	char buffer [80];
 	
 	inode_bitmap_info.entry_num=0;
 	inode_bitmap_info.group_num=group_info.group_num;
 	
 	inode_bitmap_offset=type_data.u.t_ext2_group_desc.bg_inode_bitmap;
-	sprintf (buffer,"setoffset block %ld",inode_bitmap_offset);dispatch (buffer);
+	sprintf (buffer,"setoffset block %lu",inode_bitmap_offset);dispatch (buffer);
 	sprintf (buffer,"settype inode_bitmap");dispatch (buffer);
 }
 
Index: e2fsprogs/debugfs/debugfs.c
===================================================================
--- e2fsprogs.orig/debugfs/debugfs.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/debugfs/debugfs.c	2006-05-24 15:30:20.000000000 +0200
@@ -149,13 +149,13 @@
 			data_filename = optarg;
 			break;
 		case 'b':
-			blocksize = parse_ulong(optarg, argv[0],
+			blocksize = parse_ullong(optarg, argv[0],
 						"block size", &err);
 			if (err)
 				return;
 			break;
 		case 's':
-			superblock = parse_ulong(optarg, argv[0],
+			superblock = parse_ullong(optarg, argv[0],
 						 "superblock number", &err);
 			if (err)
 				return;
@@ -232,7 +232,7 @@
 		return;
 
 	memset(&param, 0, sizeof(struct ext2_super_block));
-	param.s_blocks_count = parse_ulong(argv[2], argv[0],
+	param.s_blocks_count = parse_ullong(argv[2], argv[0],
 					   "blocks count", &err);
 	if (err)
 		return;
@@ -316,9 +316,9 @@
 	
 	gdp = &current_fs->group_desc[0];
 	for (i = 0; i < current_fs->group_desc_count; i++, gdp++) {
-		fprintf(out, " Group %2d: block bitmap at %u, "
-		        "inode bitmap at %u, "
-		        "inode table at %u\n"
+		fprintf(out, " Group %2d: block bitmap at %lu, "
+		        "inode bitmap at %lu, "
+		        "inode table at %lu\n"
 		        "           %d free %s, "
 		        "%d free %s, "
 		        "%d used %s\n",
@@ -377,9 +377,9 @@
 	else
 		fprintf(lb->f, ", ");
 	if (lb->first_block == lb->last_block)
-		fprintf(lb->f, "(%lld):%u", lb->first_bcnt, lb->first_block);
+		fprintf(lb->f, "(%lld):%lu", lb->first_bcnt, lb->first_block);
 	else
-		fprintf(lb->f, "(%lld-%lld):%u-%u", lb->first_bcnt,
+		fprintf(lb->f, "(%lld-%lld):%lu-%lu", lb->first_bcnt,
 			lb->last_bcnt, lb->first_block, lb->last_block);
 	lb->first_block = 0;
 }
@@ -421,11 +421,11 @@
 	else
 		fprintf(lb->f, ", ");
 	if (blockcnt == -1)
-		fprintf(lb->f, "(IND):%u", *blocknr);
+		fprintf(lb->f, "(IND):%lu", *blocknr);
 	else if (blockcnt == -2)
-		fprintf(lb->f, "(DIND):%u", *blocknr);
+		fprintf(lb->f, "(DIND):%lu", *blocknr);
 	else if (blockcnt == -3)
-		fprintf(lb->f, "(TIND):%u", *blocknr);
+		fprintf(lb->f, "(TIND):%lu", *blocknr);
 	return 0;
 }
 
@@ -1674,7 +1674,7 @@
 {
 	ext2_ino_t	ino;
 	blk_t		blk;
-	pblk_t		pblk;
+	blk_t		pblk;
 	int		err;
 	errcode_t	errcode;
 	
@@ -1685,7 +1685,7 @@
 	ino = string_to_inode(argv[1]);
 	if (!ino)
 		return;
-	blk = parse_ulong(argv[2], argv[0], "logical_block", &err);
+	blk = parse_ullong(argv[2], argv[0], "logical_block", &err);
 
 	errcode = ext2fs_bmap(current_fs, ino, 0, 0, 0, blk, &pblk);
 	if (errcode) {
@@ -1699,7 +1699,8 @@
 void do_imap(int argc, char *argv[])
 {
 	ext2_ino_t	ino;
-	unsigned long 	group, block, block_nr, offset;
+	unsigned long 	group, offset;
+	blk_t		block, block_nr;
 
 	if (common_args_process(argc, argv, 2, 2, argv[0],
 				"<file>", 0))
@@ -1822,11 +1823,11 @@
 			open_flags |= EXT2_FLAG_RW;
 			break;
 		case 'b':
-			blocksize = parse_ulong(optarg, argv[0], 
+			blocksize = parse_ullong(optarg, argv[0], 
 						"block size", 0);
 			break;
 		case 's':
-			superblock = parse_ulong(optarg, argv[0], 
+			superblock = parse_ullong(optarg, argv[0], 
 						 "superblock number", 0);
 			break;
 		case 'c':
Index: e2fsprogs/lib/ext2fs/tst_iscan.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/tst_iscan.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/lib/ext2fs/tst_iscan.c	2006-05-24 15:30:20.000000000 +0200
@@ -171,7 +171,7 @@
 static void check_map(void)
 {
 	int	i, j, first=1;
-	unsigned long	blk;
+	blk_t	blk;
 
 	for (i=0; test_vec[i]; i++) {
 		if (ext2fs_test_block_bitmap(touched_map, test_vec[i])) {
Index: e2fsprogs/lib/ext2fs/inode.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/inode.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/lib/ext2fs/inode.c	2006-05-24 15:30:20.000000000 +0200
@@ -502,7 +502,8 @@
 errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
 				 struct ext2_inode * inode, int bufsize)
 {
-	unsigned long 	group, block, block_nr, offset;
+	unsigned long 	group, block, offset;
+	blk_t		block_nr;
 	char 		*ptr;
 	errcode_t	retval;
 	int 		clen, i, inodes_per_block, length;
@@ -608,7 +609,8 @@
 errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
 				  struct ext2_inode * inode, int bufsize)
 {
-	unsigned long group, block, block_nr, offset;
+	unsigned long group, block, offset;
+	blk_t block_nr;
 	errcode_t retval = 0;
 	struct ext2_inode_large temp_inode, *w_inode;
 	char *ptr;
Index: e2fsprogs/e2fsck/badblocks.c
===================================================================
--- e2fsprogs.orig/e2fsck/badblocks.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/e2fsck/badblocks.c	2006-05-24 15:30:20.000000000 +0200
@@ -19,7 +19,7 @@
 
 static void invalid_block(ext2_filsys fs EXT2FS_ATTR((unused)), blk_t blk)
 {
-	printf(_("Bad block %u out of range; ignored.\n"), blk);
+	printf(_("Bad block %lu out of range; ignored.\n"), blk);
 	return;
 }
 
Index: e2fsprogs/e2fsck/journal.c
===================================================================
--- e2fsprogs.orig/e2fsck/journal.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/e2fsck/journal.c	2006-05-24 15:30:20.000000000 +0200
@@ -43,7 +43,7 @@
  * to use the recovery.c file virtually unchanged from the kernel, so we
  * don't have to do much to keep kernel and user recovery in sync.
  */
-int journal_bmap(journal_t *journal, blk_t block, unsigned long *phys)
+int journal_bmap(journal_t *journal, blk_t block, blk_t *phys)
 {
 #ifdef USE_INODE_IO
 	*phys = block;
@@ -51,7 +51,6 @@
 #else
 	struct inode 	*inode = journal->j_inode;
 	errcode_t	retval;
-	pblk_t		pblk;
 
 	if (!inode) {
 		*phys = block;
@@ -59,8 +58,7 @@
 	}
 
 	retval= ext2fs_bmap(inode->i_ctx->fs, inode->i_ino, 
-			    &inode->i_ext2, NULL, 0, block, &pblk);
-	*phys = pblk;
+			    &inode->i_ext2, NULL, 0, block, phys);
 	return (retval);
 #endif
 }
@@ -201,7 +199,7 @@
 	journal_t		*journal = NULL;
 	errcode_t		retval = 0;
 	io_manager		io_ptr = 0;
-	unsigned long		start = 0;
+	blk_t			start = 0;
 	blk_t			blk;
 	int			ext_journal = 0;
 	int			tried_backup_jnl = 0;
Index: e2fsprogs/misc/e2image.c
===================================================================
--- e2fsprogs.orig/misc/e2image.c	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/misc/e2image.c	2006-05-24 15:30:20.000000000 +0200
@@ -245,7 +245,8 @@
 static void mark_table_blocks(ext2_filsys fs)
 {
 	blk_t	block, b;
-	unsigned int	i,j;
+	unsigned int	i;
+	blk_t		j;
 	
 	block = fs->super->s_first_data_block;
 	/*
Index: e2fsprogs/e2fsck/pass5.c
===================================================================
--- e2fsprogs.orig/e2fsck/pass5.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/e2fsck/pass5.c	2006-05-24 15:30:20.000000000 +0200
@@ -114,8 +114,8 @@
 	blk_t	i, super;
 	int	*free_array;
 	int	group = 0;
-	unsigned int	blocks = 0;
-	unsigned int	free_blocks = 0;
+	blk_t	blocks = 0;
+	blk_t	free_blocks = 0;
 	int	group_free = 0;
 	int	actual, bitmap;
 	struct problem_context	pctx;
Index: e2fsprogs/lib/ext2fs/ext2fs.h
===================================================================
--- e2fsprogs.orig/lib/ext2fs/ext2fs.h	2006-05-24 15:30:18.000000000 +0200
+++ e2fsprogs/lib/ext2fs/ext2fs.h	2006-05-24 15:30:20.000000000 +0200
@@ -102,8 +102,8 @@
 struct ext2fs_struct_generic_bitmap {
 	errcode_t	magic;
 	ext2_filsys 	fs;
-	__u32		start, end;
-	__u32		real_end;
+	blk_t		start, end;
+	blk_t		real_end;
 	char	*	description;
 	char	*	bitmap;
 	errcode_t	base_error_code;
@@ -428,7 +428,7 @@
 /*
  * For ext2 compression support
  */
-#define EXT2FS_COMPRESSED_BLKADDR ((blk_t) 0xffffffff)
+#define EXT2FS_COMPRESSED_BLKADDR ((blk_t) -1)
 #define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR)
 
 /*
@@ -546,9 +546,9 @@
 extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs);
 extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs);
 extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs);
-extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
-						__u32 end,
-						__u32 real_end,
+extern errcode_t ext2fs_allocate_generic_bitmap(blk_t start,
+						blk_t end,
+						blk_t real_end,
 						const char *descr,
 						ext2fs_generic_bitmap *ret);
 extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
@@ -592,7 +592,7 @@
 extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
 			     struct ext2_inode *inode, 
 			     char *block_buf, int bmap_flags,
-			     blk_t block, pblk_t *phys_blk);
+			     blk_t block, blk_t *phys_blk);
 
 
 #if 0
Index: e2fsprogs/ext2ed/main.c
===================================================================
--- e2fsprogs.orig/ext2ed/main.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/ext2ed/main.c	2006-05-24 15:30:20.000000000 +0200
@@ -69,7 +69,7 @@
 
 char device_name [80];				/* The location of the filesystem */
 FILE *device_handle=NULL;			/* This is passed to the fopen / fread ... commands */
-long device_offset;				/* The current position in the filesystem */
+blk_t device_offset;				/* The current position in the filesystem */
 						/* Note that we have a 2 GB limitation */
 					
 int mounted=0;					/* This is set when we find that the filesystem is mounted */
Index: e2fsprogs/e2fsck/ehandler.c
===================================================================
--- e2fsprogs.orig/e2fsck/ehandler.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/e2fsck/ehandler.c	2006-05-24 15:30:20.000000000 +0200
@@ -20,7 +20,7 @@
 static const char *operation;
 
 static errcode_t e2fsck_handle_read_error(io_channel channel,
-					  unsigned long block,
+					  unsigned long long block,
 					  int count,
 					  void *data,
 					  size_t size EXT2FS_ATTR((unused)),
@@ -66,7 +66,7 @@
 }
 
 static errcode_t e2fsck_handle_write_error(io_channel channel,
-					    unsigned long block,
+					    unsigned long long block,
 					    int count,
 					    const void *data,
 					    size_t size EXT2FS_ATTR((unused)),
Index: e2fsprogs/debugfs/debugfs.h
===================================================================
--- e2fsprogs.orig/debugfs/debugfs.h	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/debugfs/debugfs.h	2006-05-24 15:30:20.000000000 +0200
@@ -32,7 +32,7 @@
 extern ext2_ino_t string_to_inode(char *str);
 extern char *time_to_string(__u32);
 extern time_t string_to_time(const char *);
-extern unsigned long parse_ulong(const char *str, const char *cmd,
+extern unsigned long long parse_ullong(const char *str, const char *cmd,
 				 const char *descr, int *err);
 extern int strtoblk(const char *cmd, const char *str, blk_t *ret);
 extern int common_args_process(int argc, char *argv[], int min_argc,
Index: e2fsprogs/e2fsck/unix.c
===================================================================
--- e2fsprogs.orig/e2fsck/unix.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/e2fsck/unix.c	2006-05-24 15:30:20.000000000 +0200
@@ -118,7 +118,7 @@
 	frag_percent = (frag_percent + 5) / 10;
 	
 	if (!verbose) {
-		printf(_("%s: %d/%d files (%0d.%d%% non-contiguous), %u/%u blocks\n"),
+		printf(_("%s: %d/%d files (%0d.%d%% non-contiguous), %lu/%lu blocks\n"),
 		       ctx->device_name, inodes_used, inodes,
 		       frag_percent / 10, frag_percent % 10,
 		       blocks_used, blocks);
@@ -132,7 +132,7 @@
 		ctx->fs_fragmented, frag_percent / 10, frag_percent % 10);
 	printf (_("         # of inodes with ind/dind/tind blocks: %d/%d/%d\n"),
 		ctx->fs_ind_count, ctx->fs_dind_count, ctx->fs_tind_count);
-	printf (P_("%8u block used (%d%%)\n", "%8u blocks used (%d%%)\n",
+	printf (P_("%8lu block used (%d%%)\n", "%8lu blocks used (%d%%)\n",
 		   blocks_used),
 		blocks_used, (int) ((long long) 100 * blocks_used / blocks));
 	printf (P_("%8d bad block\n", "%8d bad blocks\n",
@@ -300,7 +300,7 @@
 		fputs(_(", check forced.\n"), stdout);
 		return;
 	}
-	printf(_("%s: clean, %d/%d files, %u/%u blocks"), ctx->device_name,
+	printf(_("%s: clean, %d/%d files, %lu/%lu blocks"), ctx->device_name,
 	       fs->super->s_inodes_count - fs->super->s_free_inodes_count,
 	       fs->super->s_inodes_count,
 	       fs->super->s_blocks_count - fs->super->s_free_blocks_count,
Index: e2fsprogs/misc/dumpe2fs.c
===================================================================
--- e2fsprogs.orig/misc/dumpe2fs.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/misc/dumpe2fs.c	2006-05-24 15:30:20.000000000 +0200
@@ -55,7 +55,7 @@
 	exit (1);
 }
 
-static void print_number(unsigned long num)
+static void print_number(blk_t num)
 {
 	if (hex_format) 
 		printf("0x%04lx", num);
Index: e2fsprogs/misc/tune2fs.c
===================================================================
--- e2fsprogs.orig/misc/tune2fs.c	2006-05-24 15:30:05.000000000 +0200
+++ e2fsprogs/misc/tune2fs.c	2006-05-24 15:30:20.000000000 +0200
@@ -64,7 +64,8 @@
 static time_t last_check_time;
 static int print_label;
 static int max_mount_count, mount_count, mount_flags;
-static unsigned long interval, reserved_blocks;
+static unsigned long interval;
+static blk_t reserved_blocks;
 static double reserved_ratio;
 static unsigned long resgid, resuid;
 static unsigned short errors;
@@ -825,7 +826,7 @@
 	if (m_flag) {
 		sb->s_r_blocks_count = sb->s_blocks_count * reserved_ratio /100;
 		ext2fs_mark_super_dirty(fs);
-		printf (_("Setting reserved blocks percentage to %g%% (%u blocks)\n"),
+		printf (_("Setting reserved blocks percentage to %g%% (%lu blocks)\n"),
 			reserved_ratio, sb->s_r_blocks_count);
 	}
 	if (r_flag) {


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.