X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lib%2Fext2fs%2Find_block.c;h=aa82ae6b5a8167e56ad8f3ee2540c11ee229f231;hb=0e660ee14592d2e893522f2ccc836c011ca4f383;hp=9f77a079de5ded172d58e73f6ad2869677b28841;hpb=dc8ce3463791366ac844d3f0436709511fa09c49;p=tools%2Fe2fsprogs.git diff --git a/lib/ext2fs/ind_block.c b/lib/ext2fs/ind_block.c index 9f77a07..aa82ae6 100644 --- a/lib/ext2fs/ind_block.c +++ b/lib/ext2fs/ind_block.c @@ -1,15 +1,16 @@ /* * ind_block.c --- indirect block I/O routines - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + * + * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. * * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. * %End-Header% */ +#include "config.h" #include #include #if HAVE_UNISTD_H @@ -22,9 +23,11 @@ errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf) { errcode_t retval; +#ifdef WORDS_BIGENDIAN blk_t *block_nr; int i; int limit = fs->blocksize >> 2; +#endif if ((fs->flags & EXT2_FLAG_IMAGE_FILE) && (fs->io != fs->image_io)) @@ -32,33 +35,31 @@ errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf) else { retval = io_channel_read_blk(fs->io, blk, 1, buf); if (retval) - retval; - } -#ifdef EXT2FS_ENABLE_SWAPFS - if (fs->flags & (EXT2_FLAG_SWAP_BYTES | EXT2_FLAG_SWAP_BYTES_READ)) { - block_nr = (blk_t *) buf; - for (i = 0; i < limit; i++, block_nr++) - *block_nr = ext2fs_swab32(*block_nr); + return retval; } +#ifdef WORDS_BIGENDIAN + block_nr = (blk_t *) buf; + for (i = 0; i < limit; i++, block_nr++) + *block_nr = ext2fs_swab32(*block_nr); #endif return 0; } errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf) { +#ifdef WORDS_BIGENDIAN blk_t *block_nr; int i; int limit = fs->blocksize >> 2; +#endif if (fs->flags & EXT2_FLAG_IMAGE_FILE) return 0; -#ifdef EXT2FS_ENABLE_SWAPFS - if (fs->flags & (EXT2_FLAG_SWAP_BYTES | EXT2_FLAG_SWAP_BYTES_WRITE)) { - block_nr = (blk_t *) buf; - for (i = 0; i < limit; i++, block_nr++) - *block_nr = ext2fs_swab32(*block_nr); - } +#ifdef WORDS_BIGENDIAN + block_nr = (blk_t *) buf; + for (i = 0; i < limit; i++, block_nr++) + *block_nr = ext2fs_swab32(*block_nr); #endif return io_channel_write_blk(fs->io, blk, 1, buf); }