1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* openfs.c --- open an ext2 filesystem
|
|
|
|
*
|
1997-04-29 20:17:09 +04:00
|
|
|
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
1997-04-26 17:58:21 +04:00
|
|
|
*
|
1997-04-29 20:17:09 +04:00
|
|
|
* %Begin-Header%
|
1997-04-26 17:58:21 +04:00
|
|
|
* This file may be redistributed under the terms of the GNU Public
|
|
|
|
* License.
|
1997-04-29 20:17:09 +04:00
|
|
|
* %End-Header%
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1997-04-26 17:58:21 +04:00
|
|
|
#if HAVE_UNISTD_H
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <unistd.h>
|
1997-04-26 17:58:21 +04:00
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <time.h>
|
1997-10-20 03:00:21 +04:00
|
|
|
#if HAVE_SYS_STAT_H
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <sys/stat.h>
|
1997-10-20 03:00:21 +04:00
|
|
|
#endif
|
|
|
|
#if HAVE_SYS_TYPES_H
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <sys/types.h>
|
1997-10-20 03:00:21 +04:00
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
#include "ext2_fs.h"
|
1997-04-26 17:21:57 +04:00
|
|
|
#include "ext2fs.h"
|
2001-05-03 08:02:29 +04:00
|
|
|
#include "e2image.h"
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Note: if superblock is non-zero, block-size must also be non-zero.
|
|
|
|
* Superblock and block_size can be zero to use the default size.
|
1997-04-29 20:17:09 +04:00
|
|
|
*
|
|
|
|
* Valid flags for ext2fs_open()
|
|
|
|
*
|
|
|
|
* EXT2_FLAG_RW - Open the filesystem for read/write.
|
|
|
|
* EXT2_FLAG_FORCE - Open the filesystem even if some of the
|
2001-05-14 03:12:10 +04:00
|
|
|
* features aren't supported.
|
|
|
|
* EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
errcode_t ext2fs_open(const char *name, int flags, int superblock,
|
|
|
|
int block_size, io_manager manager, ext2_filsys *ret_fs)
|
|
|
|
{
|
|
|
|
ext2_filsys fs;
|
|
|
|
errcode_t retval;
|
Many files:
dosio.c: New file to do DOS/BIOS disk accesses.
namei.c (open_namei): Make pathlen be of type size_t.
llseek.c: Always #include stdlib.h since it's need to define
size_t.
io.h: Use errcode_t for magic numbers.
icount.c (get_icount_el), dupfs.c (ext2fs_dup_handle), dblist.c
(dir_block_cmp): Use size_t where appropriate.
read_bb.c (ext2fs_read_bb_inode), cmp_bitmaps.c
(ext2fs_compare_inode_bitmap): Use blk_t, ino_t and size_t
where appropriate.
closefs.c (ext2fs_flush): Use dgrp_t instead of int where
appropriate.
openfs.c (ext2fs_open), check_desc.c (ext2fs_check_desc): Use blk_t
instead of int where appropriate.
rw_bitmaps.c (read_bitmaps), irel_ma.c, inode.c (ext2fs_write_inode),
initialize.c (ext2fs_initialize): brel_ma.c: Fix to make be
16-bit safe.
link.c (ext2fs_link), unlink.c (ext2fs_unlink), lookup.c (lookup_proc),
ismounted.c (ext2fs_check_if_mounted), block.c (xlate_func):
Add #pragma argsused for Turbo C.
1997-08-12 00:29:22 +04:00
|
|
|
int i, j, groups_per_block;
|
|
|
|
blk_t group_block;
|
1997-04-26 17:21:57 +04:00
|
|
|
char *dest;
|
1997-04-26 17:58:21 +04:00
|
|
|
struct ext2_group_desc *gdp;
|
1997-04-26 17:21:57 +04:00
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER);
|
1997-10-26 06:41:24 +03:00
|
|
|
|
|
|
|
retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys),
|
|
|
|
(void **) &fs);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
memset(fs, 0, sizeof(struct struct_ext2_filsys));
|
1997-04-26 17:34:30 +04:00
|
|
|
fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS;
|
1997-04-26 17:21:57 +04:00
|
|
|
fs->flags = flags;
|
2001-12-24 17:40:00 +03:00
|
|
|
fs->umask = 022;
|
1997-04-26 17:21:57 +04:00
|
|
|
retval = manager->open(name, (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0,
|
|
|
|
&fs->io);
|
|
|
|
if (retval)
|
|
|
|
goto cleanup;
|
1997-08-24 06:57:55 +04:00
|
|
|
fs->io->app_data = fs;
|
1997-10-26 06:41:24 +03:00
|
|
|
retval = ext2fs_get_mem(strlen(name)+1, (void **) &fs->device_name);
|
|
|
|
if (retval)
|
1997-04-26 17:21:57 +04:00
|
|
|
goto cleanup;
|
|
|
|
strcpy(fs->device_name, name);
|
1997-10-26 06:41:24 +03:00
|
|
|
retval = ext2fs_get_mem(SUPERBLOCK_SIZE, (void **) &fs->super);
|
|
|
|
if (retval)
|
1997-04-26 17:21:57 +04:00
|
|
|
goto cleanup;
|
2001-05-03 08:02:29 +04:00
|
|
|
if (flags & EXT2_FLAG_IMAGE_FILE) {
|
|
|
|
retval = ext2fs_get_mem(sizeof(struct ext2_image_hdr),
|
|
|
|
(void **) &fs->image_header);
|
|
|
|
if (retval)
|
|
|
|
goto cleanup;
|
|
|
|
retval = io_channel_read_blk(fs->io, 0,
|
|
|
|
-sizeof(struct ext2_image_hdr),
|
|
|
|
fs->image_header);
|
|
|
|
if (retval)
|
|
|
|
goto cleanup;
|
|
|
|
if (fs->image_header->magic_number != EXT2_ET_MAGIC_E2IMAGE)
|
|
|
|
return EXT2_ET_MAGIC_E2IMAGE;
|
|
|
|
superblock = 1;
|
|
|
|
block_size = fs->image_header->fs_blocksize;
|
|
|
|
}
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the user specifies a specific block # for the
|
|
|
|
* superblock, then he/she must also specify the block size!
|
|
|
|
* Otherwise, read the master superblock located at offset
|
|
|
|
* SUPERBLOCK_OFFSET from the start of the partition.
|
2000-10-27 00:24:43 +04:00
|
|
|
*
|
|
|
|
* Note: we only save a backup copy of the superblock if we
|
|
|
|
* are reading the superblock from the primary superblock location.
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
if (superblock) {
|
|
|
|
if (!block_size) {
|
1997-10-31 09:07:47 +03:00
|
|
|
retval = EXT2_ET_INVALID_ARGUMENT;
|
1997-04-26 17:21:57 +04:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
io_channel_set_blksize(fs->io, block_size);
|
1997-04-26 17:34:30 +04:00
|
|
|
group_block = superblock + 1;
|
2000-10-27 00:24:43 +04:00
|
|
|
fs->orig_super = 0;
|
1997-04-26 17:21:57 +04:00
|
|
|
} else {
|
|
|
|
io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET);
|
|
|
|
superblock = 1;
|
1997-04-26 17:34:30 +04:00
|
|
|
group_block = 0;
|
2000-10-27 00:24:43 +04:00
|
|
|
retval = ext2fs_get_mem(SUPERBLOCK_SIZE,
|
|
|
|
(void **) &fs->orig_super);
|
|
|
|
if (retval)
|
|
|
|
goto cleanup;
|
1997-04-26 17:21:57 +04:00
|
|
|
}
|
|
|
|
retval = io_channel_read_blk(fs->io, superblock, -SUPERBLOCK_SIZE,
|
|
|
|
fs->super);
|
|
|
|
if (retval)
|
|
|
|
goto cleanup;
|
2000-10-27 00:24:43 +04:00
|
|
|
if (fs->orig_super)
|
|
|
|
memcpy(fs->orig_super, fs->super, SUPERBLOCK_SIZE);
|
1997-04-26 17:58:21 +04:00
|
|
|
|
ChangeLog, Makefile.in, swapfs.c, unix.c:
Makefile.in: Add message.c and swapfs.c to the list of source files to
build the make depend.
swapfs.c, unix.c: Only support the -s and -S options to e2fsck if
ENABLE_SWAPFS is defined.
Many files:
ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c, inode.c,
native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only include the
byte-swapping logic if ENABLE_SWAPFS is turned on or if we're on a
big-endian machine.
initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to set
EXT2_FLAG_SWAP_BYTES, instead of using ext2fs_native_flag.
native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
autoconf to determine whether or not return EXT2_FLAG_SWAP_BYTES.
2001-06-11 11:00:04 +04:00
|
|
|
#ifdef EXT2FS_ENABLE_SWAPFS
|
1997-04-26 17:58:21 +04:00
|
|
|
if ((fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) ||
|
1997-04-29 19:29:49 +04:00
|
|
|
(fs->flags & EXT2_FLAG_SWAP_BYTES)) {
|
|
|
|
fs->flags |= EXT2_FLAG_SWAP_BYTES;
|
1997-04-26 17:58:21 +04:00
|
|
|
|
|
|
|
ext2fs_swap_super(fs->super);
|
|
|
|
}
|
ChangeLog, Makefile.in, swapfs.c, unix.c:
Makefile.in: Add message.c and swapfs.c to the list of source files to
build the make depend.
swapfs.c, unix.c: Only support the -s and -S options to e2fsck if
ENABLE_SWAPFS is defined.
Many files:
ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c, inode.c,
native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only include the
byte-swapping logic if ENABLE_SWAPFS is turned on or if we're on a
big-endian machine.
initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to set
EXT2_FLAG_SWAP_BYTES, instead of using ext2fs_native_flag.
native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
autoconf to determine whether or not return EXT2_FLAG_SWAP_BYTES.
2001-06-11 11:00:04 +04:00
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
if (fs->super->s_magic != EXT2_SUPER_MAGIC) {
|
|
|
|
retval = EXT2_ET_BAD_MAGIC;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
1997-04-26 17:34:30 +04:00
|
|
|
if (fs->super->s_rev_level > EXT2_LIB_CURRENT_REV) {
|
|
|
|
retval = EXT2_ET_REV_TOO_HIGH;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2001-01-01 19:17:12 +03:00
|
|
|
|
1997-04-29 20:17:09 +04:00
|
|
|
/*
|
|
|
|
* Check for feature set incompatibility
|
|
|
|
*/
|
|
|
|
if (!(flags & EXT2_FLAG_FORCE)) {
|
2001-01-01 19:17:12 +03:00
|
|
|
if (fs->super->s_feature_incompat &
|
|
|
|
~EXT2_LIB_FEATURE_INCOMPAT_SUPP) {
|
1997-04-29 20:17:09 +04:00
|
|
|
retval = EXT2_ET_UNSUPP_FEATURE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
if ((flags & EXT2_FLAG_RW) &&
|
2001-01-01 19:17:12 +03:00
|
|
|
(fs->super->s_feature_ro_compat &
|
1997-04-29 21:48:10 +04:00
|
|
|
~EXT2_LIB_FEATURE_RO_COMPAT_SUPP)) {
|
1997-04-29 20:17:09 +04:00
|
|
|
retval = EXT2_ET_RO_UNSUPP_FEATURE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
if (!(flags & EXT2_FLAG_JOURNAL_DEV_OK) &&
|
|
|
|
(fs->super->s_feature_incompat &
|
|
|
|
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
|
|
|
|
retval = EXT2_ET_UNSUPP_FEATURE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
1997-04-29 20:17:09 +04:00
|
|
|
}
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
|
1997-04-29 18:53:37 +04:00
|
|
|
if (fs->blocksize == 0) {
|
|
|
|
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
1997-04-26 17:21:57 +04:00
|
|
|
fs->fragsize = EXT2_FRAG_SIZE(fs->super);
|
1997-04-26 18:48:50 +04:00
|
|
|
fs->inode_blocks_per_group = ((fs->super->s_inodes_per_group *
|
|
|
|
EXT2_INODE_SIZE(fs->super) +
|
|
|
|
EXT2_BLOCK_SIZE(fs->super) - 1) /
|
|
|
|
EXT2_BLOCK_SIZE(fs->super));
|
1997-04-26 17:21:57 +04:00
|
|
|
if (block_size) {
|
|
|
|
if (block_size != fs->blocksize) {
|
|
|
|
retval = EXT2_ET_UNEXPECTED_BLOCK_SIZE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Set the blocksize to the filesystem's blocksize.
|
|
|
|
*/
|
|
|
|
io_channel_set_blksize(fs->io, fs->blocksize);
|
ChangeLog, ext2_err.et.in, ext2fs.h, initialize.c, mkjournal.c, openfs.c:
initialize.c (ext2fs_initialize): Add support for initializing the
ext2 superblock for external journal devices. This basically means we
don't bother to allocate any block group descriptors.
openfs.c (ext2fs_open): Only open external journal devices if the new
flag EXT2_FLAG_JOURNAL_DEV_OK is passed to ext2fs_open. When opening
such devices, don't try to read the block group descriptors, since
they're not there.
ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code
mkjournal.c: Export a new function,
ext2fs_create_journal_superblock(), which allocates and returns a
buffer containing a journal superblock. This is needed by mke2fs to
create an external journal. Rewrote ext2fs_add_journal_device() so
that it no longer creates the external journal, but rather adds a
filesystem to an existing external journal. It handles all of the
UUID manipulation.
ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported by the
library. Define the EXT2_FLAG_JOURNAL_DEV_OK. Changed function
prototype for ext2fs_add_journal_device().
2001-01-16 09:56:14 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If this is an external journal device, don't try to read
|
|
|
|
* the group descriptors, because they're not there.
|
|
|
|
*/
|
|
|
|
if (fs->super->s_feature_incompat &
|
|
|
|
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
|
|
|
|
fs->group_desc_count = 0;
|
|
|
|
*ret_fs = fs;
|
|
|
|
return 0;
|
|
|
|
}
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Read group descriptors
|
|
|
|
*/
|
1999-05-30 01:48:03 +04:00
|
|
|
if ((EXT2_BLOCKS_PER_GROUP(fs->super)) == 0) {
|
|
|
|
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
1997-04-26 17:21:57 +04:00
|
|
|
fs->group_desc_count = (fs->super->s_blocks_count -
|
|
|
|
fs->super->s_first_data_block +
|
|
|
|
EXT2_BLOCKS_PER_GROUP(fs->super) - 1)
|
|
|
|
/ EXT2_BLOCKS_PER_GROUP(fs->super);
|
|
|
|
fs->desc_blocks = (fs->group_desc_count +
|
|
|
|
EXT2_DESC_PER_BLOCK(fs->super) - 1)
|
|
|
|
/ EXT2_DESC_PER_BLOCK(fs->super);
|
1997-10-26 06:41:24 +03:00
|
|
|
retval = ext2fs_get_mem(fs->desc_blocks * fs->blocksize,
|
|
|
|
(void **) &fs->group_desc);
|
|
|
|
if (retval)
|
1997-04-26 17:21:57 +04:00
|
|
|
goto cleanup;
|
1997-04-26 17:34:30 +04:00
|
|
|
if (!group_block)
|
|
|
|
group_block = fs->super->s_first_data_block + 1;
|
1997-04-26 17:21:57 +04:00
|
|
|
dest = (char *) fs->group_desc;
|
|
|
|
for (i=0 ; i < fs->desc_blocks; i++) {
|
|
|
|
retval = io_channel_read_blk(fs->io, group_block, 1, dest);
|
|
|
|
if (retval)
|
|
|
|
goto cleanup;
|
|
|
|
group_block++;
|
ChangeLog, Makefile.in, swapfs.c, unix.c:
Makefile.in: Add message.c and swapfs.c to the list of source files to
build the make depend.
swapfs.c, unix.c: Only support the -s and -S options to e2fsck if
ENABLE_SWAPFS is defined.
Many files:
ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c, inode.c,
native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only include the
byte-swapping logic if ENABLE_SWAPFS is turned on or if we're on a
big-endian machine.
initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to set
EXT2_FLAG_SWAP_BYTES, instead of using ext2fs_native_flag.
native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
autoconf to determine whether or not return EXT2_FLAG_SWAP_BYTES.
2001-06-11 11:00:04 +04:00
|
|
|
#ifdef EXT2FS_ENABLE_SWAPFS
|
1997-04-29 19:29:49 +04:00
|
|
|
if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
|
1997-04-26 17:58:21 +04:00
|
|
|
gdp = (struct ext2_group_desc *) dest;
|
|
|
|
groups_per_block = fs->blocksize /
|
|
|
|
sizeof(struct ext2_group_desc);
|
|
|
|
for (j=0; j < groups_per_block; j++)
|
|
|
|
ext2fs_swap_group_desc(gdp++);
|
|
|
|
}
|
ChangeLog, Makefile.in, swapfs.c, unix.c:
Makefile.in: Add message.c and swapfs.c to the list of source files to
build the make depend.
swapfs.c, unix.c: Only support the -s and -S options to e2fsck if
ENABLE_SWAPFS is defined.
Many files:
ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c, inode.c,
native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only include the
byte-swapping logic if ENABLE_SWAPFS is turned on or if we're on a
big-endian machine.
initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to set
EXT2_FLAG_SWAP_BYTES, instead of using ext2fs_native_flag.
native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
autoconf to determine whether or not return EXT2_FLAG_SWAP_BYTES.
2001-06-11 11:00:04 +04:00
|
|
|
#endif
|
1997-04-26 17:21:57 +04:00
|
|
|
dest += fs->blocksize;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ret_fs = fs;
|
|
|
|
return 0;
|
|
|
|
cleanup:
|
|
|
|
ext2fs_free(fs);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|