1997-04-26 17:21:57 +04:00
|
|
|
/*
|
|
|
|
* block.c --- iterate over all blocks in an inode
|
2008-08-28 07:07:54 +04:00
|
|
|
*
|
1997-04-29 20:15:03 +04:00
|
|
|
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
|
|
|
*
|
|
|
|
* %Begin-Header%
|
|
|
|
* This file may be redistributed under the terms of the GNU Public
|
|
|
|
* License.
|
|
|
|
* %End-Header%
|
1997-04-26 17:21:57 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1997-08-11 03:07:40 +04:00
|
|
|
#if HAVE_UNISTD_H
|
1997-04-26 17:21:57 +04:00
|
|
|
#include <unistd.h>
|
1997-08-11 03:07:40 +04:00
|
|
|
#endif
|
1997-04-26 17:34:30 +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"
|
|
|
|
|
|
|
|
struct block_context {
|
|
|
|
ext2_filsys fs;
|
|
|
|
int (*func)(ext2_filsys fs,
|
|
|
|
blk_t *blocknr,
|
1998-06-11 00:39:43 +04:00
|
|
|
e2_blkcnt_t bcount,
|
1997-04-29 20:15:03 +04:00
|
|
|
blk_t ref_blk,
|
|
|
|
int ref_offset,
|
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
|
|
|
void *priv_data);
|
1998-06-11 00:39:43 +04:00
|
|
|
e2_blkcnt_t bcount;
|
1997-04-26 17:21:57 +04:00
|
|
|
int bsize;
|
|
|
|
int flags;
|
|
|
|
errcode_t errcode;
|
|
|
|
char *ind_buf;
|
|
|
|
char *dind_buf;
|
|
|
|
char *tind_buf;
|
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
|
|
|
void *priv_data;
|
1997-04-26 17:21:57 +04:00
|
|
|
};
|
|
|
|
|
2008-02-04 06:29:16 +03:00
|
|
|
#define check_for_ro_violation_return(ctx, ret) \
|
2008-02-03 05:26:54 +03:00
|
|
|
do { \
|
|
|
|
if (((ctx)->flags & BLOCK_FLAG_READ_ONLY) && \
|
|
|
|
((ret) & BLOCK_CHANGED)) { \
|
|
|
|
(ctx)->errcode = EXT2_ET_RO_BLOCK_ITERATE; \
|
2008-02-04 06:29:16 +03:00
|
|
|
ret |= BLOCK_ABORT | BLOCK_ERROR; \
|
|
|
|
return ret; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define check_for_ro_violation_goto(ctx, ret, label) \
|
|
|
|
do { \
|
|
|
|
if (((ctx)->flags & BLOCK_FLAG_READ_ONLY) && \
|
|
|
|
((ret) & BLOCK_CHANGED)) { \
|
|
|
|
(ctx)->errcode = EXT2_ET_RO_BLOCK_ITERATE; \
|
|
|
|
ret |= BLOCK_ABORT | BLOCK_ERROR; \
|
|
|
|
goto label; \
|
2008-02-03 05:26:54 +03:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
|
|
|
|
int ref_offset, struct block_context *ctx)
|
1997-04-26 17:21:57 +04:00
|
|
|
{
|
|
|
|
int ret = 0, changed = 0;
|
1997-04-29 20:15:03 +04:00
|
|
|
int i, flags, limit, offset;
|
1997-04-26 17:21:57 +04:00
|
|
|
blk_t *block_nr;
|
|
|
|
|
1997-04-30 01:26:48 +04:00
|
|
|
limit = ctx->fs->blocksize >> 2;
|
1997-04-29 18:53:37 +04:00
|
|
|
if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
|
|
|
|
!(ctx->flags & BLOCK_FLAG_DATA_ONLY))
|
|
|
|
ret = (*ctx->func)(ctx->fs, ind_block,
|
1997-04-29 20:15:03 +04:00
|
|
|
BLOCK_COUNT_IND, ref_block,
|
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
|
|
|
ref_offset, ctx->priv_data);
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, ret);
|
1997-04-30 01:26:48 +04:00
|
|
|
if (!*ind_block || (ret & BLOCK_ABORT)) {
|
|
|
|
ctx->bcount += limit;
|
1997-04-26 17:21:57 +04:00
|
|
|
return ret;
|
1997-04-30 01:26:48 +04:00
|
|
|
}
|
1997-04-26 17:34:30 +04:00
|
|
|
if (*ind_block >= ctx->fs->super->s_blocks_count ||
|
|
|
|
*ind_block < ctx->fs->super->s_first_data_block) {
|
|
|
|
ctx->errcode = EXT2_ET_BAD_IND_BLOCK;
|
|
|
|
ret |= BLOCK_ERROR;
|
|
|
|
return ret;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block,
|
2005-01-06 08:04:24 +03:00
|
|
|
ctx->ind_buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ctx->errcode) {
|
|
|
|
ret |= BLOCK_ERROR;
|
|
|
|
return ret;
|
|
|
|
}
|
2005-01-06 08:04:24 +03:00
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
block_nr = (blk_t *) ctx->ind_buf;
|
1997-04-29 20:15:03 +04:00
|
|
|
offset = 0;
|
1997-04-26 17:58:21 +04:00
|
|
|
if (ctx->flags & BLOCK_FLAG_APPEND) {
|
|
|
|
for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
|
1997-04-26 17:21:57 +04:00
|
|
|
flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
|
2008-08-28 07:07:54 +04:00
|
|
|
*ind_block, offset,
|
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
|
|
|
ctx->priv_data);
|
1997-04-26 17:58:21 +04:00
|
|
|
changed |= flags;
|
|
|
|
if (flags & BLOCK_ABORT) {
|
|
|
|
ret |= BLOCK_ABORT;
|
|
|
|
break;
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
offset += sizeof(blk_t);
|
1997-04-26 17:58:21 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
|
|
|
|
if (*block_nr == 0)
|
|
|
|
continue;
|
|
|
|
flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
|
2008-08-28 07:07:54 +04:00
|
|
|
*ind_block, offset,
|
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
|
|
|
ctx->priv_data);
|
1997-04-26 17:58:21 +04:00
|
|
|
changed |= flags;
|
1997-04-26 17:21:57 +04:00
|
|
|
if (flags & BLOCK_ABORT) {
|
|
|
|
ret |= BLOCK_ABORT;
|
|
|
|
break;
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
offset += sizeof(blk_t);
|
1997-04-26 17:21:57 +04:00
|
|
|
}
|
|
|
|
}
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, changed);
|
2005-01-06 08:04:24 +03:00
|
|
|
if (changed & BLOCK_CHANGED) {
|
|
|
|
ctx->errcode = ext2fs_write_ind_block(ctx->fs, *ind_block,
|
|
|
|
ctx->ind_buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ctx->errcode)
|
|
|
|
ret |= BLOCK_ERROR | BLOCK_ABORT;
|
|
|
|
}
|
|
|
|
if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
|
1997-04-29 18:53:37 +04:00
|
|
|
!(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
|
1997-04-26 17:21:57 +04:00
|
|
|
!(ret & BLOCK_ABORT))
|
1997-04-29 18:53:37 +04:00
|
|
|
ret |= (*ctx->func)(ctx->fs, ind_block,
|
1997-04-29 20:15:03 +04:00
|
|
|
BLOCK_COUNT_IND, ref_block,
|
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
|
|
|
ref_offset, ctx->priv_data);
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, ret);
|
1997-04-26 17:21:57 +04:00
|
|
|
return ret;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
|
|
|
|
int ref_offset, struct block_context *ctx)
|
1997-04-26 17:21:57 +04:00
|
|
|
{
|
|
|
|
int ret = 0, changed = 0;
|
1997-04-29 20:15:03 +04:00
|
|
|
int i, flags, limit, offset;
|
1997-04-26 17:21:57 +04:00
|
|
|
blk_t *block_nr;
|
|
|
|
|
1997-04-30 01:26:48 +04:00
|
|
|
limit = ctx->fs->blocksize >> 2;
|
2000-04-03 17:51:00 +04:00
|
|
|
if (!(ctx->flags & (BLOCK_FLAG_DEPTH_TRAVERSE |
|
|
|
|
BLOCK_FLAG_DATA_ONLY)))
|
1997-04-29 18:53:37 +04:00
|
|
|
ret = (*ctx->func)(ctx->fs, dind_block,
|
1997-04-29 20:15:03 +04:00
|
|
|
BLOCK_COUNT_DIND, ref_block,
|
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
|
|
|
ref_offset, ctx->priv_data);
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, ret);
|
1997-04-30 01:26:48 +04:00
|
|
|
if (!*dind_block || (ret & BLOCK_ABORT)) {
|
|
|
|
ctx->bcount += limit*limit;
|
1997-04-26 17:21:57 +04:00
|
|
|
return ret;
|
1997-04-30 01:26:48 +04:00
|
|
|
}
|
1997-04-26 17:34:30 +04:00
|
|
|
if (*dind_block >= ctx->fs->super->s_blocks_count ||
|
|
|
|
*dind_block < ctx->fs->super->s_first_data_block) {
|
|
|
|
ctx->errcode = EXT2_ET_BAD_DIND_BLOCK;
|
|
|
|
ret |= BLOCK_ERROR;
|
|
|
|
return ret;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block,
|
2005-01-06 08:04:24 +03:00
|
|
|
ctx->dind_buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ctx->errcode) {
|
|
|
|
ret |= BLOCK_ERROR;
|
|
|
|
return ret;
|
|
|
|
}
|
2005-01-06 08:04:24 +03:00
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
block_nr = (blk_t *) ctx->dind_buf;
|
1997-04-29 20:15:03 +04:00
|
|
|
offset = 0;
|
1997-04-26 17:58:21 +04:00
|
|
|
if (ctx->flags & BLOCK_FLAG_APPEND) {
|
|
|
|
for (i = 0; i < limit; i++, block_nr++) {
|
1997-04-29 20:15:03 +04:00
|
|
|
flags = block_iterate_ind(block_nr,
|
|
|
|
*dind_block, offset,
|
|
|
|
ctx);
|
1997-04-26 17:58:21 +04:00
|
|
|
changed |= flags;
|
|
|
|
if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
|
|
|
|
ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
|
|
|
|
break;
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
offset += sizeof(blk_t);
|
1997-04-26 17:58:21 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < limit; i++, block_nr++) {
|
1997-04-30 01:26:48 +04:00
|
|
|
if (*block_nr == 0) {
|
|
|
|
ctx->bcount += limit;
|
1997-04-26 17:58:21 +04:00
|
|
|
continue;
|
1997-04-30 01:26:48 +04:00
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
flags = block_iterate_ind(block_nr,
|
|
|
|
*dind_block, offset,
|
|
|
|
ctx);
|
1997-04-26 17:58:21 +04:00
|
|
|
changed |= flags;
|
1997-04-26 17:21:57 +04:00
|
|
|
if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
|
|
|
|
ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
|
|
|
|
break;
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
offset += sizeof(blk_t);
|
1997-04-26 17:21:57 +04:00
|
|
|
}
|
|
|
|
}
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, changed);
|
2005-01-06 08:04:24 +03:00
|
|
|
if (changed & BLOCK_CHANGED) {
|
|
|
|
ctx->errcode = ext2fs_write_ind_block(ctx->fs, *dind_block,
|
|
|
|
ctx->dind_buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ctx->errcode)
|
|
|
|
ret |= BLOCK_ERROR | BLOCK_ABORT;
|
|
|
|
}
|
|
|
|
if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
|
1997-04-29 18:53:37 +04:00
|
|
|
!(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
|
1997-04-26 17:21:57 +04:00
|
|
|
!(ret & BLOCK_ABORT))
|
1997-04-29 18:53:37 +04:00
|
|
|
ret |= (*ctx->func)(ctx->fs, dind_block,
|
1997-04-29 20:15:03 +04:00
|
|
|
BLOCK_COUNT_DIND, ref_block,
|
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
|
|
|
ref_offset, ctx->priv_data);
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, ret);
|
1997-04-26 17:21:57 +04:00
|
|
|
return ret;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
|
|
|
|
int ref_offset, struct block_context *ctx)
|
1997-04-26 17:21:57 +04:00
|
|
|
{
|
|
|
|
int ret = 0, changed = 0;
|
1997-04-29 20:15:03 +04:00
|
|
|
int i, flags, limit, offset;
|
1997-04-26 17:21:57 +04:00
|
|
|
blk_t *block_nr;
|
|
|
|
|
1997-04-30 01:26:48 +04:00
|
|
|
limit = ctx->fs->blocksize >> 2;
|
2000-04-03 17:51:00 +04:00
|
|
|
if (!(ctx->flags & (BLOCK_FLAG_DEPTH_TRAVERSE |
|
|
|
|
BLOCK_FLAG_DATA_ONLY)))
|
1997-04-29 18:53:37 +04:00
|
|
|
ret = (*ctx->func)(ctx->fs, tind_block,
|
1997-04-29 20:15:03 +04:00
|
|
|
BLOCK_COUNT_TIND, ref_block,
|
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
|
|
|
ref_offset, ctx->priv_data);
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, ret);
|
1997-04-30 01:26:48 +04:00
|
|
|
if (!*tind_block || (ret & BLOCK_ABORT)) {
|
|
|
|
ctx->bcount += limit*limit*limit;
|
1997-04-26 17:21:57 +04:00
|
|
|
return ret;
|
1997-04-30 01:26:48 +04:00
|
|
|
}
|
1997-04-26 17:34:30 +04:00
|
|
|
if (*tind_block >= ctx->fs->super->s_blocks_count ||
|
|
|
|
*tind_block < ctx->fs->super->s_first_data_block) {
|
|
|
|
ctx->errcode = EXT2_ET_BAD_TIND_BLOCK;
|
|
|
|
ret |= BLOCK_ERROR;
|
|
|
|
return ret;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block,
|
2005-01-06 08:04:24 +03:00
|
|
|
ctx->tind_buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ctx->errcode) {
|
|
|
|
ret |= BLOCK_ERROR;
|
|
|
|
return ret;
|
|
|
|
}
|
2005-01-06 08:04:24 +03:00
|
|
|
|
1997-04-26 17:58:21 +04:00
|
|
|
block_nr = (blk_t *) ctx->tind_buf;
|
1997-04-29 20:15:03 +04:00
|
|
|
offset = 0;
|
1997-04-26 17:58:21 +04:00
|
|
|
if (ctx->flags & BLOCK_FLAG_APPEND) {
|
|
|
|
for (i = 0; i < limit; i++, block_nr++) {
|
1997-04-29 20:15:03 +04:00
|
|
|
flags = block_iterate_dind(block_nr,
|
|
|
|
*tind_block,
|
|
|
|
offset, ctx);
|
1997-04-26 17:58:21 +04:00
|
|
|
changed |= flags;
|
|
|
|
if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
|
|
|
|
ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
|
|
|
|
break;
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
offset += sizeof(blk_t);
|
1997-04-26 17:58:21 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < limit; i++, block_nr++) {
|
1997-04-30 01:26:48 +04:00
|
|
|
if (*block_nr == 0) {
|
|
|
|
ctx->bcount += limit*limit;
|
1997-04-26 17:58:21 +04:00
|
|
|
continue;
|
1997-04-30 01:26:48 +04:00
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
flags = block_iterate_dind(block_nr,
|
|
|
|
*tind_block,
|
|
|
|
offset, ctx);
|
1997-04-26 17:58:21 +04:00
|
|
|
changed |= flags;
|
1997-04-26 17:21:57 +04:00
|
|
|
if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
|
|
|
|
ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
|
|
|
|
break;
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
offset += sizeof(blk_t);
|
1997-04-26 17:21:57 +04:00
|
|
|
}
|
|
|
|
}
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, changed);
|
2005-01-06 08:04:24 +03:00
|
|
|
if (changed & BLOCK_CHANGED) {
|
|
|
|
ctx->errcode = ext2fs_write_ind_block(ctx->fs, *tind_block,
|
|
|
|
ctx->tind_buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ctx->errcode)
|
|
|
|
ret |= BLOCK_ERROR | BLOCK_ABORT;
|
|
|
|
}
|
|
|
|
if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
|
1997-04-29 18:53:37 +04:00
|
|
|
!(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
|
1997-04-26 17:21:57 +04:00
|
|
|
!(ret & BLOCK_ABORT))
|
1997-04-29 18:53:37 +04:00
|
|
|
ret |= (*ctx->func)(ctx->fs, tind_block,
|
1997-04-29 20:15:03 +04:00
|
|
|
BLOCK_COUNT_TIND, ref_block,
|
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
|
|
|
ref_offset, ctx->priv_data);
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_return(ctx, ret);
|
1997-04-26 17:21:57 +04:00
|
|
|
return ret;
|
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
|
Many files:
block.c (ext2fs_block_iterate3): Make the ref_offset field contain the
offset into the inode.i_blocks array when ref_block is zero. Since we
haven't done a formal release of e2fsprogs since block_iterate2 was
first introduced, I removed block_iterate2, and renamed block_iterate3
to be block_iterate2.
bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c, expanddir.c,
ext2fs.h, ext2fsP.h, read_bb.c: Change use of block_iterate and
block_iterate2 to block_iterate2 with the new prototype for the
interator function. (using blkcnt_t forr blockcount)
ChangeLog, debugfs.c, ls.c, lsdel.c:
debugfs.c, ls.c, lsdel.c: Add support for large files. (The high 32
bits share space with the i_dir_acl field.)
1998-03-24 19:17:51 +03:00
|
|
|
errcode_t ext2fs_block_iterate2(ext2_filsys fs,
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
ext2_ino_t ino,
|
1997-04-29 20:15:03 +04:00
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
|
|
|
int (*func)(ext2_filsys fs,
|
|
|
|
blk_t *blocknr,
|
1998-06-11 00:39:43 +04:00
|
|
|
e2_blkcnt_t blockcnt,
|
1997-04-29 20:15:03 +04:00
|
|
|
blk_t ref_blk,
|
|
|
|
int ref_offset,
|
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
|
|
|
void *priv_data),
|
|
|
|
void *priv_data)
|
1997-04-26 17:21:57 +04:00
|
|
|
{
|
|
|
|
int i;
|
2008-05-27 14:59:32 +04:00
|
|
|
int r, ret = 0;
|
1997-04-26 17:21:57 +04:00
|
|
|
struct ext2_inode inode;
|
|
|
|
errcode_t retval;
|
1997-04-29 20:15:03 +04:00
|
|
|
struct block_context ctx;
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
int limit;
|
1997-04-29 20:15:03 +04:00
|
|
|
|
1997-04-26 17:34:30 +04:00
|
|
|
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
|
|
|
|
|
2008-02-04 06:29:16 +03:00
|
|
|
ctx.errcode = ext2fs_read_inode(fs, ino, &inode);
|
|
|
|
if (ctx.errcode)
|
|
|
|
return ctx.errcode;
|
|
|
|
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
/*
|
|
|
|
* Check to see if we need to limit large files
|
|
|
|
*/
|
|
|
|
if (flags & BLOCK_FLAG_NO_LARGE) {
|
|
|
|
if (!LINUX_S_ISDIR(inode.i_mode) &&
|
|
|
|
(inode.i_size_high != 0))
|
|
|
|
return EXT2_ET_FILE_TOO_BIG;
|
|
|
|
}
|
|
|
|
|
|
|
|
limit = fs->blocksize >> 2;
|
|
|
|
|
1997-04-26 17:21:57 +04:00
|
|
|
ctx.fs = fs;
|
|
|
|
ctx.func = func;
|
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
|
|
|
ctx.priv_data = priv_data;
|
1997-04-26 17:21:57 +04:00
|
|
|
ctx.flags = flags;
|
1997-04-29 20:15:03 +04:00
|
|
|
ctx.bcount = 0;
|
1997-04-26 17:21:57 +04:00
|
|
|
if (block_buf) {
|
|
|
|
ctx.ind_buf = block_buf;
|
|
|
|
} else {
|
2007-11-10 03:01:06 +03:00
|
|
|
retval = ext2fs_get_array(3, fs->blocksize, &ctx.ind_buf);
|
1997-10-26 06:41:24 +03:00
|
|
|
if (retval)
|
|
|
|
return retval;
|
1997-04-26 17:21:57 +04:00
|
|
|
}
|
|
|
|
ctx.dind_buf = ctx.ind_buf + fs->blocksize;
|
|
|
|
ctx.tind_buf = ctx.dind_buf + fs->blocksize;
|
1997-04-29 18:53:37 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Iterate over the HURD translator block (if present)
|
|
|
|
*/
|
|
|
|
if ((fs->super->s_creator_os == EXT2_OS_HURD) &&
|
1997-04-29 19:29:49 +04:00
|
|
|
!(flags & BLOCK_FLAG_DATA_ONLY)) {
|
|
|
|
if (inode.osd1.hurd1.h_i_translator) {
|
1997-04-29 20:15:03 +04:00
|
|
|
ret |= (*ctx.func)(fs,
|
|
|
|
&inode.osd1.hurd1.h_i_translator,
|
|
|
|
BLOCK_COUNT_TRANSLATOR,
|
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
|
|
|
0, 0, priv_data);
|
1997-04-29 19:29:49 +04:00
|
|
|
if (ret & BLOCK_ABORT)
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
goto abort_exit;
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_goto(&ctx, ret, abort_exit);
|
1997-04-29 19:29:49 +04:00
|
|
|
}
|
1997-04-29 18:53:37 +04:00
|
|
|
}
|
2008-08-28 07:07:54 +04:00
|
|
|
|
2008-02-04 06:29:16 +03:00
|
|
|
if (inode.i_flags & EXT4_EXTENTS_FL) {
|
|
|
|
ext2_extent_handle_t handle;
|
|
|
|
struct ext2fs_extent extent;
|
2008-08-27 23:17:36 +04:00
|
|
|
e2_blkcnt_t blockcnt = 0;
|
2008-05-27 14:59:32 +04:00
|
|
|
blk_t blk, new_blk;
|
2008-02-04 06:29:16 +03:00
|
|
|
int op = EXT2_EXTENT_ROOT;
|
2009-01-20 03:30:59 +03:00
|
|
|
int uninit;
|
2008-03-18 06:17:13 +03:00
|
|
|
unsigned int j;
|
2008-02-04 06:29:16 +03:00
|
|
|
|
2009-05-20 00:34:12 +04:00
|
|
|
ctx.errcode = ext2fs_extent_open2(fs, ino, &inode, &handle);
|
2008-02-04 06:29:16 +03:00
|
|
|
if (ctx.errcode)
|
|
|
|
goto abort_exit;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
ctx.errcode = ext2fs_extent_get(handle, op, &extent);
|
|
|
|
if (ctx.errcode) {
|
2008-08-27 23:17:36 +04:00
|
|
|
if (ctx.errcode != EXT2_ET_EXTENT_NO_NEXT)
|
|
|
|
break;
|
|
|
|
ctx.errcode = 0;
|
|
|
|
if (!(flags & BLOCK_FLAG_APPEND))
|
|
|
|
break;
|
|
|
|
blk = 0;
|
|
|
|
r = (*ctx.func)(fs, &blk, blockcnt,
|
|
|
|
0, 0, priv_data);
|
|
|
|
ret |= r;
|
|
|
|
check_for_ro_violation_goto(&ctx, ret,
|
|
|
|
extent_errout);
|
|
|
|
if (r & BLOCK_CHANGED) {
|
2008-08-28 07:07:54 +04:00
|
|
|
ctx.errcode =
|
2008-08-27 23:17:36 +04:00
|
|
|
ext2fs_extent_set_bmap(handle,
|
|
|
|
(blk64_t) blockcnt++,
|
|
|
|
(blk64_t) blk, 0);
|
|
|
|
if (ctx.errcode || (ret & BLOCK_ABORT))
|
2008-08-28 01:50:14 +04:00
|
|
|
break;
|
2008-08-27 23:17:36 +04:00
|
|
|
continue;
|
|
|
|
}
|
2008-08-28 01:50:14 +04:00
|
|
|
break;
|
2008-02-04 06:29:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
op = EXT2_EXTENT_NEXT;
|
|
|
|
blk = extent.e_pblk;
|
2008-05-27 14:59:32 +04:00
|
|
|
if (!(extent.e_flags & EXT2_EXTENT_FLAGS_LEAF)) {
|
|
|
|
if (ctx.flags & BLOCK_FLAG_DATA_ONLY)
|
|
|
|
continue;
|
|
|
|
if ((!(extent.e_flags &
|
|
|
|
EXT2_EXTENT_FLAGS_SECOND_VISIT) &&
|
|
|
|
!(ctx.flags & BLOCK_FLAG_DEPTH_TRAVERSE)) ||
|
|
|
|
((extent.e_flags &
|
|
|
|
EXT2_EXTENT_FLAGS_SECOND_VISIT) &&
|
|
|
|
(ctx.flags & BLOCK_FLAG_DEPTH_TRAVERSE))) {
|
|
|
|
ret |= (*ctx.func)(fs, &blk,
|
|
|
|
-1, 0, 0, priv_data);
|
|
|
|
if (ret & BLOCK_CHANGED) {
|
2008-08-22 10:50:02 +04:00
|
|
|
extent.e_pblk = blk;
|
|
|
|
ctx.errcode =
|
|
|
|
ext2fs_extent_replace(handle, 0, &extent);
|
|
|
|
if (ctx.errcode)
|
2008-08-28 01:50:14 +04:00
|
|
|
break;
|
2008-05-27 14:59:32 +04:00
|
|
|
}
|
|
|
|
}
|
2008-02-04 06:29:16 +03:00
|
|
|
continue;
|
|
|
|
}
|
2009-01-20 03:30:59 +03:00
|
|
|
uninit = 0;
|
|
|
|
if (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT)
|
|
|
|
uninit = EXT2_EXTENT_SET_BMAP_UNINIT;
|
2008-03-18 06:17:13 +03:00
|
|
|
for (blockcnt = extent.e_lblk, j = 0;
|
|
|
|
j < extent.e_len;
|
|
|
|
blk++, blockcnt++, j++) {
|
2008-05-27 14:59:32 +04:00
|
|
|
new_blk = blk;
|
|
|
|
r = (*ctx.func)(fs, &new_blk, blockcnt,
|
|
|
|
0, 0, priv_data);
|
|
|
|
ret |= r;
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_goto(&ctx, ret,
|
|
|
|
extent_errout);
|
2008-05-27 14:59:32 +04:00
|
|
|
if (r & BLOCK_CHANGED) {
|
|
|
|
ctx.errcode =
|
|
|
|
ext2fs_extent_set_bmap(handle,
|
|
|
|
(blk64_t) blockcnt,
|
2009-01-20 03:30:59 +03:00
|
|
|
(blk64_t) new_blk,
|
|
|
|
uninit);
|
2008-05-27 14:59:32 +04:00
|
|
|
if (ctx.errcode)
|
2009-01-19 22:22:52 +03:00
|
|
|
goto extent_errout;
|
2008-02-04 06:29:16 +03:00
|
|
|
}
|
2008-08-28 01:50:14 +04:00
|
|
|
if (ret & BLOCK_ABORT)
|
|
|
|
break;
|
2008-02-04 06:29:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extent_errout:
|
|
|
|
ext2fs_extent_free(handle);
|
|
|
|
ret |= BLOCK_ERROR | BLOCK_ABORT;
|
2008-05-27 14:59:32 +04:00
|
|
|
goto errout;
|
2008-02-04 06:29:16 +03:00
|
|
|
}
|
|
|
|
|
1997-04-29 18:53:37 +04:00
|
|
|
/*
|
|
|
|
* Iterate over normal data blocks
|
|
|
|
*/
|
1997-04-26 17:21:57 +04:00
|
|
|
for (i = 0; i < EXT2_NDIR_BLOCKS ; i++, ctx.bcount++) {
|
2008-02-04 06:29:16 +03:00
|
|
|
if (inode.i_block[i] || (flags & BLOCK_FLAG_APPEND)) {
|
|
|
|
ret |= (*ctx.func)(fs, &inode.i_block[i],
|
Many files:
block.c (ext2fs_block_iterate3): Make the ref_offset field contain the
offset into the inode.i_blocks array when ref_block is zero. Since we
haven't done a formal release of e2fsprogs since block_iterate2 was
first introduced, I removed block_iterate2, and renamed block_iterate3
to be block_iterate2.
bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c, expanddir.c,
ext2fs.h, ext2fsP.h, read_bb.c: Change use of block_iterate and
block_iterate2 to block_iterate2 with the new prototype for the
interator function. (using blkcnt_t forr blockcount)
ChangeLog, debugfs.c, ls.c, lsdel.c:
debugfs.c, ls.c, lsdel.c: Add support for large files. (The high 32
bits share space with the i_dir_acl field.)
1998-03-24 19:17:51 +03:00
|
|
|
ctx.bcount, 0, i, priv_data);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ret & BLOCK_ABORT)
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
goto abort_exit;
|
1997-04-26 17:21:57 +04:00
|
|
|
}
|
|
|
|
}
|
2008-02-04 06:29:16 +03:00
|
|
|
check_for_ro_violation_goto(&ctx, ret, abort_exit);
|
|
|
|
if (inode.i_block[EXT2_IND_BLOCK] || (flags & BLOCK_FLAG_APPEND)) {
|
|
|
|
ret |= block_iterate_ind(&inode.i_block[EXT2_IND_BLOCK],
|
Many files:
block.c (ext2fs_block_iterate3): Make the ref_offset field contain the
offset into the inode.i_blocks array when ref_block is zero. Since we
haven't done a formal release of e2fsprogs since block_iterate2 was
first introduced, I removed block_iterate2, and renamed block_iterate3
to be block_iterate2.
bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c, expanddir.c,
ext2fs.h, ext2fsP.h, read_bb.c: Change use of block_iterate and
block_iterate2 to block_iterate2 with the new prototype for the
interator function. (using blkcnt_t forr blockcount)
ChangeLog, debugfs.c, ls.c, lsdel.c:
debugfs.c, ls.c, lsdel.c: Add support for large files. (The high 32
bits share space with the i_dir_acl field.)
1998-03-24 19:17:51 +03:00
|
|
|
0, EXT2_IND_BLOCK, &ctx);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ret & BLOCK_ABORT)
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
goto abort_exit;
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
} else
|
|
|
|
ctx.bcount += limit;
|
2008-02-04 06:29:16 +03:00
|
|
|
if (inode.i_block[EXT2_DIND_BLOCK] || (flags & BLOCK_FLAG_APPEND)) {
|
|
|
|
ret |= block_iterate_dind(&inode.i_block[EXT2_DIND_BLOCK],
|
Many files:
block.c (ext2fs_block_iterate3): Make the ref_offset field contain the
offset into the inode.i_blocks array when ref_block is zero. Since we
haven't done a formal release of e2fsprogs since block_iterate2 was
first introduced, I removed block_iterate2, and renamed block_iterate3
to be block_iterate2.
bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c, expanddir.c,
ext2fs.h, ext2fsP.h, read_bb.c: Change use of block_iterate and
block_iterate2 to block_iterate2 with the new prototype for the
interator function. (using blkcnt_t forr blockcount)
ChangeLog, debugfs.c, ls.c, lsdel.c:
debugfs.c, ls.c, lsdel.c: Add support for large files. (The high 32
bits share space with the i_dir_acl field.)
1998-03-24 19:17:51 +03:00
|
|
|
0, EXT2_DIND_BLOCK, &ctx);
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ret & BLOCK_ABORT)
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
goto abort_exit;
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
} else
|
|
|
|
ctx.bcount += limit * limit;
|
2008-02-04 06:29:16 +03:00
|
|
|
if (inode.i_block[EXT2_TIND_BLOCK] || (flags & BLOCK_FLAG_APPEND)) {
|
|
|
|
ret |= block_iterate_tind(&inode.i_block[EXT2_TIND_BLOCK],
|
Many files:
block.c (ext2fs_block_iterate3): Make the ref_offset field contain the
offset into the inode.i_blocks array when ref_block is zero. Since we
haven't done a formal release of e2fsprogs since block_iterate2 was
first introduced, I removed block_iterate2, and renamed block_iterate3
to be block_iterate2.
bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c, expanddir.c,
ext2fs.h, ext2fsP.h, read_bb.c: Change use of block_iterate and
block_iterate2 to block_iterate2 with the new prototype for the
interator function. (using blkcnt_t forr blockcount)
ChangeLog, debugfs.c, ls.c, lsdel.c:
debugfs.c, ls.c, lsdel.c: Add support for large files. (The high 32
bits share space with the i_dir_acl field.)
1998-03-24 19:17:51 +03:00
|
|
|
0, EXT2_TIND_BLOCK, &ctx);
|
1997-04-29 18:53:37 +04:00
|
|
|
if (ret & BLOCK_ABORT)
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
goto abort_exit;
|
1997-04-29 18:53:37 +04:00
|
|
|
}
|
1997-04-26 17:21:57 +04:00
|
|
|
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
abort_exit:
|
1997-04-26 17:21:57 +04:00
|
|
|
if (ret & BLOCK_CHANGED) {
|
|
|
|
retval = ext2fs_write_inode(fs, ino, &inode);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
}
|
2008-05-27 14:59:32 +04:00
|
|
|
errout:
|
1997-04-26 17:21:57 +04:00
|
|
|
if (!block_buf)
|
2003-08-01 17:41:07 +04:00
|
|
|
ext2fs_free_mem(&ctx.ind_buf);
|
1997-04-26 17:21:57 +04:00
|
|
|
|
|
|
|
return (ret & BLOCK_ERROR) ? ctx.errcode : 0;
|
|
|
|
}
|
1997-04-29 20:15:03 +04:00
|
|
|
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
/*
|
|
|
|
* Emulate the old ext2fs_block_iterate function!
|
|
|
|
*/
|
|
|
|
|
1997-04-29 20:15:03 +04:00
|
|
|
struct xlate {
|
|
|
|
int (*func)(ext2_filsys fs,
|
|
|
|
blk_t *blocknr,
|
|
|
|
int bcount,
|
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
|
|
|
void *priv_data);
|
1997-04-29 20:15:03 +04:00
|
|
|
void *real_private;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
#ifdef __TURBOC__
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
#pragma argsused
|
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
|
|
|
#endif
|
1998-06-11 00:39:43 +04:00
|
|
|
static int xlate_func(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
|
2003-12-07 09:28:50 +03:00
|
|
|
blk_t ref_block EXT2FS_ATTR((unused)),
|
|
|
|
int ref_offset EXT2FS_ATTR((unused)),
|
|
|
|
void *priv_data)
|
1997-04-29 20:15:03 +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
|
|
|
struct xlate *xl = (struct xlate *) priv_data;
|
1997-04-29 20:15:03 +04:00
|
|
|
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
return (*xl->func)(fs, blocknr, (int) blockcnt, xl->real_private);
|
1997-04-29 20:15:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
errcode_t ext2fs_block_iterate(ext2_filsys fs,
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
ext2_ino_t ino,
|
1997-04-29 20:15:03 +04:00
|
|
|
int flags,
|
|
|
|
char *block_buf,
|
|
|
|
int (*func)(ext2_filsys fs,
|
|
|
|
blk_t *blocknr,
|
|
|
|
int blockcnt,
|
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
|
|
|
void *priv_data),
|
|
|
|
void *priv_data)
|
1997-04-29 20:15:03 +04:00
|
|
|
{
|
|
|
|
struct xlate xl;
|
2008-08-28 07:07:54 +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
|
|
|
xl.real_private = priv_data;
|
1997-04-29 20:15:03 +04:00
|
|
|
xl.func = func;
|
|
|
|
|
Many files:
block.c (ext2fs_block_iterate3): Make the ref_offset field contain the
offset into the inode.i_blocks array when ref_block is zero. Since we
haven't done a formal release of e2fsprogs since block_iterate2 was
first introduced, I removed block_iterate2, and renamed block_iterate3
to be block_iterate2.
bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c, expanddir.c,
ext2fs.h, ext2fsP.h, read_bb.c: Change use of block_iterate and
block_iterate2 to block_iterate2 with the new prototype for the
interator function. (using blkcnt_t forr blockcount)
ChangeLog, debugfs.c, ls.c, lsdel.c:
debugfs.c, ls.c, lsdel.c: Add support for large files. (The high 32
bits share space with the i_dir_acl field.)
1998-03-24 19:17:51 +03:00
|
|
|
return ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_NO_LARGE | flags,
|
Many files:
ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap,
s_prealloc_blocks, s_prealloc_dir_blocks). Added conditional defines
of new features COMPAT_DIR_PREALLOC, RO_COMPAT_LARGE_FILE
RO_COMPAT_BTREE_DIR, INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.
Changed the library to declare that we support COMPAT_DIR_PREALLOC,
INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
fileio.c: Rename function ext2fs_file_llseek to be ext2fs_file_lseek,
which is more accurate.
block.c: Add new function ext2fs_block_iterate3 which calls the
iterator function with the blockcount argument of type blkcnt_t. This
version of the function is allowed to handle large files; the other
fucntions are not.
ext2fs.h: Add new type blkcnt_t
ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
block.c (ext2fs_block_iterate2): Fix bug where the block count field
wasn't getting correctly incremented for sparse files when the
indirect or doubly-indirect block specified in the inode was zero.
unlink.c (unlink_proc):
lookup.c (lookup_proc):
link.c (link_proc):
get_pathname.c (get_pathname_proc):
dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits from
dirent->name_len, so it can be used for other purposes.
ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE, and
indicate that we have support for this incompatible option.
1998-03-23 05:06:52 +03:00
|
|
|
block_buf, xlate_func, &xl);
|
|
|
|
}
|
|
|
|
|