From cbbf031b6edf9bdf5511af2193e44cff7fdaa66a Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 13 Jun 2001 00:12:04 +0000 Subject: [PATCH] ChangeLog, dumpe2fs.c, mke2fs.c: dumpe2fs.c: Use WORDS_BIGENDIAN to determine whether or not we're (not) using i386 byte order. dumpe2fs.c, mke2fs.c: Stop using the compatibility badblocks function, and use the ext2fs_badblocks_* functions instead. ChangeLog, inode.c, tst_iscan.c: inode.c, tst_iscan.c: Stop using the compatibility badblocks function, and use the ext2fs_badblocks_* functions instead. ChangeLog, badblocks.c: badblocks.c: Stop using the compatibility badblocks function, and use the ext2fs_badblocks_* functions instead. --- e2fsck/ChangeLog | 5 +++++ e2fsck/badblocks.c | 2 +- lib/ext2fs/ChangeLog | 6 ++++++ lib/ext2fs/inode.c | 2 +- lib/ext2fs/tst_iscan.c | 4 ++-- misc/ChangeLog | 7 +++++++ misc/dumpe2fs.c | 31 ++++++++++++------------------- misc/mke2fs.c | 14 +++++++------- 8 files changed, 41 insertions(+), 30 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 38b2c13..7190cb8 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,8 @@ +2001-06-12 Theodore Tso + + * badblocks.c: Stop using the compatibility badblocks function, + and use the ext2fs_badblocks_* functions instead. + 2001-06-11 Theodore Tso * unix.c (PRS): Fix bug introduced in 1.20 which broke the -F diff --git a/e2fsck/badblocks.c b/e2fsck/badblocks.c index f435792..c7cc8cc 100644 --- a/e2fsck/badblocks.c +++ b/e2fsck/badblocks.c @@ -103,7 +103,7 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file, goto fatal; } - badblocks_list_free(bb_list); + ext2fs_badblocks_list_free(bb_list); return; fatal: diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 710f79e..038fdda 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,9 @@ +2001-06-12 Theodore Tso + + * inode.c, tst_iscan.c: Stop using the compatibility badblocks + function, and use the ext2fs_badblocks_* functions + instead. + 2001-06-11 Theodore Tso * Makefile.in, gen_bitmap.c, bitops.h: Move inline functions diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c index 5b4dd2b..2da328c 100644 --- a/lib/ext2fs/inode.c +++ b/lib/ext2fs/inode.c @@ -121,7 +121,7 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, fs->get_blocks = 0; retval = ext2fs_read_bb_inode(fs, &fs->badblocks); if (retval && fs->badblocks) { - badblocks_list_free(fs->badblocks); + ext2fs_badblocks_list_free(fs->badblocks); fs->badblocks = 0; } fs->get_blocks = save_get_blocks; diff --git a/lib/ext2fs/tst_iscan.c b/lib/ext2fs/tst_iscan.c index f966d0b..2cf4336 100644 --- a/lib/ext2fs/tst_iscan.c +++ b/lib/ext2fs/tst_iscan.c @@ -111,13 +111,13 @@ static void setup(void) exit(1); } - retval = badblocks_list_create(&test_badblocks, 5); + retval = ext2fs_badblocks_list_create(&test_badblocks, 5); if (retval) { com_err("setup", retval, "while creating badblocks list"); exit(1); } for (i=0; test_vec[i]; i++) { - retval = badblocks_list_add(test_badblocks, test_vec[i]); + retval = ext2fs_badblocks_list_add(test_badblocks, test_vec[i]); if (retval) { com_err("setup", retval, "while adding test vector %d", i); diff --git a/misc/ChangeLog b/misc/ChangeLog index 747ddcf..e22366d 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,5 +1,12 @@ 2001-06-12 Theodore Tso + * dumpe2fs.c: Use WORDS_BIGENDIAN to determine whether or not + we're (not) using i386 byte order. + + * dumpe2fs.c, mke2fs.c: Stop using the compatibility badblocks + function, and use the ext2fs_badblocks_* functions + instead. + * fsck.c (device_already_active): Fixed bug which can cause fsck to core dump if there are a mix of devices with standard and non-standard names. diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index de68d09..e5caac2 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -163,17 +163,17 @@ static void list_bad_blocks(ext2_filsys fs) com_err("ext2fs_read_bb_inode", retval, ""); exit(1); } - retval = badblocks_list_iterate_begin(bb_list, &bb_iter); + retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter); if (retval) { - com_err("badblocks_list_iterate_begin", retval, + com_err("ext2fs_badblocks_list_iterate_begin", retval, _("while printing bad block list")); exit(1); } - if (badblocks_list_iterate(bb_iter, &blk)) + if (ext2fs_badblocks_list_iterate(bb_iter, &blk)) printf(_("Bad blocks: %d"), blk); - while (badblocks_list_iterate(bb_iter, &blk)) + while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) printf(", %d", blk); - badblocks_list_iterate_end(bb_iter); + ext2fs_badblocks_list_iterate_end(bb_iter); printf("\n"); } @@ -189,23 +189,15 @@ static void dump_bad_blocks(ext2_filsys fs) com_err("ext2fs_read_bb_inode", retval, ""); exit(1); } - retval = badblocks_list_iterate_begin(bb_list, &bb_iter); + retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter); if (retval) { - com_err("badblocks_list_iterate_begin", retval, + com_err("ext2fs_badblocks_list_iterate_begin", retval, _("while printing bad block list")); exit(1); } - while (badblocks_list_iterate(bb_iter, &blk)) + while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) printf("%d\n", blk); - badblocks_list_iterate_end(bb_iter); -} - -static int i386_byteorder(void) -{ - int one = 1; - char *cp = (char *) &one; - - return (*cp == 1); + ext2fs_badblocks_list_iterate_end(bb_iter); } static void print_journal_information(ext2_filsys fs) @@ -331,8 +323,9 @@ int main (int argc, char ** argv) dump_bad_blocks(fs); } else { big_endian = ((fs->flags & EXT2_FLAG_SWAP_BYTES) != 0); - if (!i386_byteorder()) - big_endian = !big_endian; +#ifdef WORDS_BIGENDIAN + big_endian = !big_endian; +#endif if (big_endian) printf(_("Note: This is a byte-swapped filesystem\n")); list_super (fs->super); diff --git a/misc/mke2fs.c b/misc/mke2fs.c index a801ad0..65c7cdb 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -255,7 +255,7 @@ static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list) */ must_be_good = fs->super->s_first_data_block + 1 + fs->desc_blocks; for (i = fs->super->s_first_data_block; i <= must_be_good; i++) { - if (badblocks_list_test(bb_list, i)) { + if (ext2fs_badblocks_list_test(bb_list, i)) { fprintf(stderr, _("Block %d in primary " "superblock/group descriptor area bad.\n"), i); fprintf(stderr, _("Blocks %d through %d must be good " @@ -277,8 +277,8 @@ static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list) for (i = 1; i < fs->group_desc_count; i++) { group_bad = 0; for (j=0; j < fs->desc_blocks+1; j++) { - if (badblocks_list_test(bb_list, group_block + - j)) { + if (ext2fs_badblocks_list_test(bb_list, + group_block + j)) { if (!group_bad) fprintf(stderr, _("Warning: the backup superblock/group descriptors at block %d contain\n" @@ -296,15 +296,15 @@ _("Warning: the backup superblock/group descriptors at block %d contain\n" /* * Mark all the bad blocks as used... */ - retval = badblocks_list_iterate_begin(bb_list, &bb_iter); + retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter); if (retval) { - com_err("badblocks_list_iterate_begin", retval, + com_err("ext2fs_badblocks_list_iterate_begin", retval, _("while marking bad blocks as used")); exit(1); } - while (badblocks_list_iterate(bb_iter, &blk)) + while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) ext2fs_mark_block_bitmap(fs->block_map, blk); - badblocks_list_iterate_end(bb_iter); + ext2fs_badblocks_list_iterate_end(bb_iter); } /* -- 1.8.3.1