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)
bitmap-optimize
Theodore Ts'o 1998-01-19 14:47:53 +00:00
parent 45d2161466
commit b5abe6fac9
55 changed files with 390 additions and 118 deletions

View File

@ -1,3 +1,51 @@
Sat Jan 17 13:13:31 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
* 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++.
Tue Jan 6 11:28:15 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
* closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
Mon Dec 29 14:39:13 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
* 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)
Fri Nov 28 09:26:31 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
* dblist.c (ext2fs_get_num_dirs): Make ext2fs_get_num_dirs more

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -24,7 +24,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"

View File

@ -27,7 +27,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -43,10 +47,11 @@ struct set_badblock_record {
};
static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt,
blk_t ref_block, int ref_offset, void *private);
blk_t ref_block, int ref_offset,
void *priv_data);
static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt,
blk_t ref_block, int ref_offset,
void *private);
void *priv_data);
/*
* Given a bad blocks bitmap, update the bad blocks inode to reflect
@ -159,10 +164,11 @@ cleanup:
#pragma argsused
#endif
static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt,
blk_t ref_block, int ref_offset, void *private)
blk_t ref_block, int ref_offset,
void *priv_data)
{
struct set_badblock_record *rec = (struct set_badblock_record *)
private;
priv_data;
errcode_t retval;
int group;
@ -217,10 +223,10 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt,
#endif
static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
int blockcnt, blk_t ref_block,
int ref_offset, void *private)
int ref_offset, void *priv_data)
{
struct set_badblock_record *rec = (struct set_badblock_record *)
private;
priv_data;
errcode_t retval;
blk_t blk;
int group;

View File

@ -24,7 +24,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -87,16 +91,16 @@ errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
ext2fs_generic_bitmap *dest)
{
errcode_t retval;
ext2fs_generic_bitmap new;
ext2fs_generic_bitmap new_map;
retval = make_bitmap(src->start, src->end, src->real_end,
src->description, src->bitmap, &new);
src->description, src->bitmap, &new_map);
if (retval)
return retval;
new->magic = src->magic;
new->fs = src->fs;
new->base_error_code = src->base_error_code;
*dest = new;
new_map->magic = src->magic;
new_map->fs = src->fs;
new_map->base_error_code = src->base_error_code;
*dest = new_map;
return 0;
}

View File

@ -15,7 +15,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -26,7 +30,7 @@ struct block_context {
int bcount,
blk_t ref_blk,
int ref_offset,
void *private);
void *priv_data);
int bcount;
int bsize;
int flags;
@ -34,7 +38,7 @@ struct block_context {
char *ind_buf;
char *dind_buf;
char *tind_buf;
void *private;
void *priv_data;
};
static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
@ -49,7 +53,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
!(ctx->flags & BLOCK_FLAG_DATA_ONLY))
ret = (*ctx->func)(ctx->fs, ind_block,
BLOCK_COUNT_IND, ref_block,
ref_offset, ctx->private);
ref_offset, ctx->priv_data);
if (!*ind_block || (ret & BLOCK_ABORT)) {
ctx->bcount += limit;
return ret;
@ -78,7 +82,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
*ind_block, offset,
ctx->private);
ctx->priv_data);
changed |= flags;
if (flags & BLOCK_ABORT) {
ret |= BLOCK_ABORT;
@ -92,7 +96,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
continue;
flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
*ind_block, offset,
ctx->private);
ctx->priv_data);
changed |= flags;
if (flags & BLOCK_ABORT) {
ret |= BLOCK_ABORT;
@ -118,7 +122,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
!(ret & BLOCK_ABORT))
ret |= (*ctx->func)(ctx->fs, ind_block,
BLOCK_COUNT_IND, ref_block,
ref_offset, ctx->private);
ref_offset, ctx->priv_data);
return ret;
}
@ -134,7 +138,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
!(ctx->flags & BLOCK_FLAG_DATA_ONLY))
ret = (*ctx->func)(ctx->fs, dind_block,
BLOCK_COUNT_DIND, ref_block,
ref_offset, ctx->private);
ref_offset, ctx->priv_data);
if (!*dind_block || (ret & BLOCK_ABORT)) {
ctx->bcount += limit*limit;
return ret;
@ -205,7 +209,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
!(ret & BLOCK_ABORT))
ret |= (*ctx->func)(ctx->fs, dind_block,
BLOCK_COUNT_DIND, ref_block,
ref_offset, ctx->private);
ref_offset, ctx->priv_data);
return ret;
}
@ -221,7 +225,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
!(ctx->flags & BLOCK_FLAG_DATA_ONLY))
ret = (*ctx->func)(ctx->fs, tind_block,
BLOCK_COUNT_TIND, ref_block,
ref_offset, ctx->private);
ref_offset, ctx->priv_data);
if (!*tind_block || (ret & BLOCK_ABORT)) {
ctx->bcount += limit*limit*limit;
return ret;
@ -292,7 +296,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
!(ret & BLOCK_ABORT))
ret |= (*ctx->func)(ctx->fs, tind_block,
BLOCK_COUNT_TIND, ref_block,
ref_offset, ctx->private);
ref_offset, ctx->priv_data);
return ret;
}
@ -306,8 +310,8 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
int blockcnt,
blk_t ref_blk,
int ref_offset,
void *private),
void *private)
void *priv_data),
void *priv_data)
{
int i;
int got_inode = 0;
@ -325,7 +329,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
ctx.fs = fs;
ctx.func = func;
ctx.private = private;
ctx.priv_data = priv_data;
ctx.flags = flags;
ctx.bcount = 0;
if (block_buf) {
@ -352,7 +356,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
ret |= (*ctx.func)(fs,
&inode.osd1.hurd1.h_i_translator,
BLOCK_COUNT_TRANSLATOR,
0, 0, private);
0, 0, priv_data);
if (ret & BLOCK_ABORT)
goto abort;
}
@ -364,7 +368,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
for (i = 0; i < EXT2_NDIR_BLOCKS ; i++, ctx.bcount++) {
if (blocks[i] || (flags & BLOCK_FLAG_APPEND)) {
ret |= (*ctx.func)(fs, &blocks[i],
ctx.bcount, 0, 0, private);
ctx.bcount, 0, 0, priv_data);
if (ret & BLOCK_ABORT)
goto abort;
}
@ -412,7 +416,7 @@ struct xlate {
int (*func)(ext2_filsys fs,
blk_t *blocknr,
int bcount,
void *private);
void *priv_data);
void *real_private;
};
@ -420,9 +424,9 @@ struct xlate {
#pragma argsused
#endif
static int xlate_func(ext2_filsys fs, blk_t *blocknr, int blockcnt,
blk_t ref_block, int ref_offset, void *private)
blk_t ref_block, int ref_offset, void *priv_data)
{
struct xlate *xl = private;
struct xlate *xl = (struct xlate *) priv_data;
return (*xl->func)(fs, blocknr, blockcnt, xl->real_private);
}
@ -434,12 +438,12 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs,
int (*func)(ext2_filsys fs,
blk_t *blocknr,
int blockcnt,
void *private),
void *private)
void *priv_data),
void *priv_data)
{
struct xlate xl;
xl.real_private = private;
xl.real_private = priv_data;
xl.func = func;
return ext2fs_block_iterate2(fs, ino, flags, block_buf,

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -18,7 +18,12 @@
#include <sys/time.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs/ext2fs.h"
struct process_block_struct {
@ -34,13 +39,14 @@ struct process_block_struct {
static int process_block(ext2_filsys fs, blk_t *block_nr,
int blockcnt, blk_t ref_block,
int ref_offset, void *private)
int ref_offset, void *priv_data)
{
struct process_block_struct *pb = private;
struct process_block_struct *pb;
errcode_t retval;
int ret;
blk_t block, orig;
pb = (struct process_block_struct *) priv_data;
block = orig = *block_nr;
ret = 0;

View File

@ -29,7 +29,7 @@ struct ext2_block_relocation_table {
__u32 magic;
char *name;
blk_t current;
void *private;
void *priv_data;
/*
* Add a block relocation entry.

View File

@ -22,7 +22,11 @@
#include <errno.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
#include "brel.h"
@ -72,7 +76,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block,
if (retval)
goto errout;
memset(ma, 0, sizeof(struct brel_ma));
brel->private = ma;
brel->priv_data = ma;
size = (size_t) (sizeof(struct ext2_block_relocate_entry) *
(max_block+1));
@ -106,7 +110,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old,
{
struct brel_ma *ma;
ma = brel->private;
ma = brel->priv_data;
if (old > ma->max_block)
return EXT2_ET_INVALID_ARGUMENT;
ma->entries[(unsigned)old] = *ent;
@ -118,7 +122,7 @@ static errcode_t bma_get(ext2_brel brel, blk_t old,
{
struct brel_ma *ma;
ma = brel->private;
ma = brel->priv_data;
if (old > ma->max_block)
return EXT2_ET_INVALID_ARGUMENT;
if (ma->entries[(unsigned)old].new == 0)
@ -138,7 +142,7 @@ static errcode_t bma_next(ext2_brel brel, blk_t *old,
{
struct brel_ma *ma;
ma = brel->private;
ma = brel->priv_data;
while (++brel->current < ma->max_block) {
if (ma->entries[(unsigned)brel->current].new == 0)
continue;
@ -154,7 +158,7 @@ static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new)
{
struct brel_ma *ma;
ma = brel->private;
ma = brel->priv_data;
if ((old > ma->max_block) || (new > ma->max_block))
return EXT2_ET_INVALID_ARGUMENT;
if (ma->entries[(unsigned)old].new == 0)
@ -168,7 +172,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old)
{
struct brel_ma *ma;
ma = brel->private;
ma = brel->priv_data;
if (old > ma->max_block)
return EXT2_ET_INVALID_ARGUMENT;
if (ma->entries[(unsigned)old].new == 0)
@ -184,7 +188,7 @@ static errcode_t bma_free(ext2_brel brel)
if (!brel)
return 0;
ma = brel->private;
ma = brel->priv_data;
if (ma) {
if (ma->entries)

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -16,7 +16,11 @@
#include <time.h>
#include <string.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"
@ -162,7 +166,11 @@ errcode_t ext2fs_flush(ext2_filsys fs)
if (retval)
goto errout;
}
retval = 0;
/*
* Flush the blocks out to disk
*/
retval = io_channel_flush(fs->io);
errout:
fs->super->s_state = fs_state;
if (fs->flags & EXT2_FLAG_SWAP_BYTES) {

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -17,7 +17,11 @@
#include <string.h>
#include <time.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"
@ -154,7 +158,7 @@ errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest)
errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
int blockcnt)
{
struct ext2_db_entry *new;
struct ext2_db_entry *new_entry;
errcode_t retval;
EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
@ -169,10 +173,10 @@ errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
return retval;
}
}
new = dblist->list + ( (int) dblist->count++);
new->blk = blk;
new->ino = ino;
new->blockcnt = blockcnt;
new_entry = dblist->list + ( (int) dblist->count++);
new_entry->blk = blk;
new_entry->ino = ino;
new_entry->blockcnt = blockcnt;
dblist->sorted = 0;
@ -206,8 +210,8 @@ errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
int (*func)(ext2_filsys fs,
struct ext2_db_entry *db_info,
void *private),
void *private)
void *priv_data),
void *priv_data)
{
ino_t i;
int ret;
@ -220,7 +224,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
dblist->sorted = 1;
}
for (i=0; i < dblist->count; i++) {
ret = (*func)(dblist->fs, &dblist->list[(int)i], private);
ret = (*func)(dblist->fs, &dblist->list[(int)i], priv_data);
if (ret & DBLIST_ABORT)
return 0;
}

View File

@ -17,12 +17,16 @@
#include <string.h>
#include <time.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"
static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
void *private);
void *priv_data);
extern errcode_t
ext2fs_dblist_dir_iterate(ext2_dblist dblist,
@ -34,8 +38,8 @@ extern errcode_t
int offset,
int blocksize,
char *buf,
void *private),
void *private)
void *priv_data),
void *priv_data)
{
errcode_t retval;
struct dir_context ctx;
@ -54,7 +58,7 @@ extern errcode_t
}
ctx.func = 0;
ctx.func2 = func;
ctx.private = private;
ctx.priv_data = priv_data;
ctx.errcode = 0;
retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx);
@ -67,12 +71,13 @@ extern errcode_t
}
static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
void *private)
void *priv_data)
{
struct dir_context *ctx = private;
struct dir_context *ctx;
ctx = (struct dir_context *) priv_data;
ctx->dir = db_info->ino;
return ext2fs_process_dir_block(fs, &db_info->blk,
db_info->blockcnt, private);
db_info->blockcnt, priv_data);
}

View File

@ -18,7 +18,11 @@
#include <errno.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"
@ -30,8 +34,8 @@ errcode_t ext2fs_dir_iterate(ext2_filsys fs,
int offset,
int blocksize,
char *buf,
void *private),
void *private)
void *priv_data),
void *priv_data)
{
struct dir_context ctx;
errcode_t retval;
@ -53,7 +57,7 @@ errcode_t ext2fs_dir_iterate(ext2_filsys fs,
}
ctx.func = func;
ctx.func2 = 0;
ctx.private = private;
ctx.priv_data = priv_data;
ctx.errcode = 0;
retval = ext2fs_block_iterate(fs, dir, 0, 0,
ext2fs_process_dir_block, &ctx);
@ -71,9 +75,9 @@ errcode_t ext2fs_dir_iterate(ext2_filsys fs,
extern int ext2fs_process_dir_block(ext2_filsys fs,
blk_t *blocknr,
int blockcnt,
void *private)
void *priv_data)
{
struct dir_context *ctx = (struct dir_context *) private;
struct dir_context *ctx = (struct dir_context *) priv_data;
int offset = 0;
int ret = 0;
int changed = 0;
@ -98,11 +102,11 @@ extern int ext2fs_process_dir_block(ext2_filsys fs,
if (ctx->func)
ret = (ctx->func)(dirent, offset, fs->blocksize,
ctx->buf, ctx->private);
ctx->buf, ctx->priv_data);
else if (ctx->func2) {
ret = (ctx->func2)(ctx->dir, entry, dirent, offset,
fs->blocksize, ctx->buf,
ctx->private);
ctx->priv_data);
if (entry < DIRENT_OTHER_FILE)
entry++;
}

View File

@ -16,7 +16,11 @@
#include <string.h>
#include <time.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -33,7 +37,7 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
if ((fs->flags & (EXT2_FLAG_SWAP_BYTES|
EXT2_FLAG_SWAP_BYTES_READ)) == 0)
return 0;
p = buf;
p = (char *) buf;
end = (char *) buf + fs->blocksize;
while (p < end) {
dirent = (struct ext2_dir_entry *) p;
@ -70,7 +74,7 @@ errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
dirent->name_len = ext2fs_swab16(dirent->name_len);
}
} else
write_buf = inbuf;
write_buf = (char *) inbuf;
retval = io_channel_write_blk(fs->io, block, 1, write_buf);
if (buf)
ext2fs_free_mem((void **) &buf);

View File

@ -16,7 +16,11 @@
#include <time.h>
#include <string.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -27,9 +31,9 @@ struct expand_dir_struct {
static int expand_dir_proc(ext2_filsys fs,
blk_t *blocknr,
int blockcnt,
void *private)
void *priv_data)
{
struct expand_dir_struct *es = (struct expand_dir_struct *) private;
struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
blk_t new_blk;
static blk_t last_blk = 0;
char *block;

View File

@ -43,9 +43,15 @@ typedef __u32 blk_t;
typedef unsigned int dgrp_t;
typedef __u32 ext2_off_t;
#if EXT2_FLAT_INCLUDES
#include "com_err.h"
#include "ext2_io.h"
#include "ext2_err.h"
#else
#include "et/com_err.h"
#include "ext2fs/ext2_io.h"
#include "ext2fs/ext2_err.h"
#endif
typedef struct struct_ext2_filsys *ext2_filsys;
@ -173,7 +179,7 @@ struct struct_ext2_filsys {
/*
* Reserved for the use of the calling application.
*/
void * private;
void * priv_data;
/*
* Inode cache
@ -477,8 +483,8 @@ extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
int (*func)(ext2_filsys fs,
blk_t *blocknr,
int blockcnt,
void *private),
void *private);
void *priv_data),
void *priv_data);
errcode_t ext2fs_block_iterate2(ext2_filsys fs,
ino_t ino,
@ -489,8 +495,8 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
int blockcnt,
blk_t ref_blk,
int ref_offset,
void *private),
void *private);
void *priv_data),
void *priv_data);
/* bmap.c */
extern errcode_t ext2fs_bmap(ext2_filsys fs, ino_t ino,
@ -527,8 +533,8 @@ extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino,
blk_t blk, int blockcnt);
extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info,
void *private),
void *private);
void *priv_data),
void *priv_data);
extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino,
blk_t blk, int blockcnt);
extern errcode_t ext2fs_copy_dblist(ext2_dblist src,
@ -546,8 +552,8 @@ extern errcode_t
int offset,
int blocksize,
char *buf,
void *private),
void *private);
void *priv_data),
void *priv_data);
/* dirblock.c */
extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
@ -564,13 +570,13 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
int offset,
int blocksize,
char *buf,
void *private),
void *private);
/* private to library */
void *priv_data),
void *priv_data);
/* priv_data to library */
extern int ext2fs_process_dir_block(ext2_filsys fs,
blk_t *blocknr,
int blockcnt,
void *private);
void *priv_data);
/* dupfs.c */
extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest);
@ -622,7 +628,7 @@ extern void ext2fs_set_inode_callback
errcode_t (*done_group)(ext2_filsys fs,
ext2_inode_scan scan,
dgrp_t group,
void * private),
void * priv_data),
void *done_group_data);
extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
int clear_flags);

View File

@ -52,15 +52,15 @@ struct dir_context {
int offset,
int blocksize,
char *buf,
void *private);
void *priv_data);
int (*func2)(ino_t dir,
int entry,
struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *private);
void *private;
void *priv_data);
void *priv_data;
errcode_t errcode;
};
@ -86,5 +86,5 @@ struct ext2_inode_cache_ent {
extern int ext2_process_dir_block(ext2_filsys fs,
blk_t *blocknr,
int blockcnt,
void *private);
void *priv_data);

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -145,7 +149,7 @@ errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
errcode_t retval;
blk_t b, pb;
unsigned int start, left, c, count = 0;
char *ptr = buf;
char *ptr = (char *) buf;
EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
fs = file->fs;
@ -215,7 +219,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, void *buf,
errcode_t retval;
blk_t b, pb;
unsigned int start, c, count = 0;
char *ptr = buf;
char *ptr = (char *) buf;
EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
fs = file->fs;

View File

@ -14,7 +14,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"

View File

@ -24,7 +24,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -42,12 +46,12 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *private)
void *priv_data)
{
struct get_pathname_struct *gp;
errcode_t retval;
gp = (struct get_pathname_struct *) private;
gp = (struct get_pathname_struct *) priv_data;
if ((dirent->name_len == 2) &&
!strncmp(dirent->name, "..", 2))

View File

@ -26,7 +26,12 @@
#include <sys/disklabel.h>
#endif /* HAVE_SYS_DISKLABEL_H */
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
static int valid_offset (int fd, ext2_loff_t offset)

View File

@ -16,7 +16,12 @@
#include <string.h>
#include <stdio.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
/*
@ -170,8 +175,8 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount,
if (icount->count >= icount->size) {
if (icount->count) {
new_size = icount->list[(unsigned)icount->count-1].ino;
new_size = icount->count *
((float) new_size / icount->num_inodes);
new_size = (ino_t) (icount->count *
((float) new_size / icount->num_inodes));
}
if (new_size < (icount->size + 100))
new_size = icount->size + 100;

View File

@ -24,7 +24,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -26,7 +26,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#define INCLUDE_INLINE_FUNCS

View File

@ -21,7 +21,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fsP.h"
@ -43,7 +47,7 @@ struct ext2_struct_inode_scan {
errcode_t (*done_group)(ext2_filsys fs,
ext2_inode_scan scan,
dgrp_t group,
void * private);
void * priv_data);
void * done_group_data;
int bad_block_ptr;
int scan_flags;
@ -123,9 +127,13 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
scan->fs = fs;
scan->inode_size = EXT2_INODE_SIZE(fs->super);
scan->bytes_left = 0;
scan->current_group = -1;
scan->current_group = 0;
scan->groups_left = fs->group_desc_count - 1;
scan->inode_buffer_blocks = buffer_blocks ? buffer_blocks : 8;
scan->groups_left = fs->group_desc_count;
scan->current_block = scan->fs->
group_desc[scan->current_group].bg_inode_table;
scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
scan->blocks_left = scan->fs->inode_blocks_per_group;
retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks *
fs->blocksize),
(void **) &scan->inode_buffer);
@ -166,7 +174,7 @@ void ext2fs_set_inode_callback(ext2_inode_scan scan,
errcode_t (*done_group)(ext2_filsys fs,
ext2_inode_scan scan,
dgrp_t group,
void * private),
void * priv_data),
void *done_group_data)
{
if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN))

View File

@ -27,7 +27,7 @@ struct ext2_inode_relocation_table {
__u32 magic;
char *name;
ino_t current;
void *private;
void *priv_data;
/*
* Add an inode relocation entry.

View File

@ -19,7 +19,11 @@
#include <errno.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
#include "irel.h"
@ -88,7 +92,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ino_t max_inode,
if (retval)
goto errout;
memset(ma, 0, sizeof(struct irel_ma));
irel->private = ma;
irel->priv_data = ma;
size = (size_t) (sizeof(ino_t) * (max_inode+1));
retval = ext2fs_get_mem(size, (void **) &ma->orig_map);
@ -142,7 +146,7 @@ static errcode_t ima_put(ext2_irel irel, ino_t old,
errcode_t retval;
int size;
ma = irel->private;
ma = irel->priv_data;
if (old > ma->max_inode)
return EXT2_ET_INVALID_ARGUMENT;
@ -177,7 +181,7 @@ static errcode_t ima_get(ext2_irel irel, ino_t old,
{
struct irel_ma *ma;
ma = irel->private;
ma = irel->priv_data;
if (old > ma->max_inode)
return EXT2_ET_INVALID_ARGUMENT;
if (ma->entries[(unsigned) old].new == 0)
@ -192,7 +196,7 @@ static errcode_t ima_get_by_orig(ext2_irel irel, ino_t orig, ino_t *old,
struct irel_ma *ma;
ino_t ino;
ma = irel->private;
ma = irel->priv_data;
if (orig > ma->max_inode)
return EXT2_ET_INVALID_ARGUMENT;
ino = ma->orig_map[(unsigned) orig];
@ -214,7 +218,7 @@ static errcode_t ima_next(ext2_irel irel, ino_t *old,
{
struct irel_ma *ma;
ma = irel->private;
ma = irel->priv_data;
while (++irel->current < ma->max_inode) {
if (ma->entries[(unsigned) irel->current].new == 0)
continue;
@ -235,7 +239,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ino_t ino,
struct ext2_inode_relocate_entry *ent;
errcode_t retval;
ma = irel->private;
ma = irel->priv_data;
if (ino > ma->max_inode)
return EXT2_ET_INVALID_ARGUMENT;
@ -266,7 +270,7 @@ static errcode_t ima_start_iter_ref(ext2_irel irel, ino_t ino)
{
struct irel_ma *ma;
ma = irel->private;
ma = irel->priv_data;
if (ino > ma->max_inode)
return EXT2_ET_INVALID_ARGUMENT;
if (ma->entries[(unsigned) ino].new == 0)
@ -282,7 +286,7 @@ static errcode_t ima_next_ref(ext2_irel irel,
struct irel_ma *ma;
struct inode_reference_entry *ref_ent;
ma = irel->private;
ma = irel->priv_data;
ref_ent = ma->ref_entries + ma->ref_current;
@ -301,7 +305,7 @@ static errcode_t ima_move(ext2_irel irel, ino_t old, ino_t new)
{
struct irel_ma *ma;
ma = irel->private;
ma = irel->priv_data;
if ((old > ma->max_inode) || (new > ma->max_inode))
return EXT2_ET_INVALID_ARGUMENT;
if (ma->entries[(unsigned) old].new == 0)
@ -324,7 +328,7 @@ static errcode_t ima_delete(ext2_irel irel, ino_t old)
{
struct irel_ma *ma;
ma = irel->private;
ma = irel->priv_data;
if (old > ma->max_inode)
return EXT2_ET_INVALID_ARGUMENT;
if (ma->entries[(unsigned) old].new == 0)
@ -348,7 +352,7 @@ static errcode_t ima_free(ext2_irel irel)
if (!irel)
return 0;
ma = irel->private;
ma = irel->priv_data;
if (ma) {
if (ma->orig_map)

View File

@ -29,7 +29,12 @@
#include <sys/mount.h>
#endif /* HAVE_GETMNTINFO */
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
#ifdef HAVE_MNTENT_H

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -31,9 +35,9 @@ static int link_proc(struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *private)
void *priv_data)
{
struct link_struct *ls = (struct link_struct *) private;
struct link_struct *ls = (struct link_struct *) priv_data;
struct ext2_dir_entry *next;
int rec_len;
int ret = 0;

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -33,9 +37,9 @@ static int lookup_proc(struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *private)
void *priv_data)
{
struct lookup_struct *ls = (struct lookup_struct *) private;
struct lookup_struct *ls = (struct lookup_struct *) priv_data;
if (ls->len != dirent->name_len)
return 0;

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -17,7 +17,11 @@
/* #define NAMEI_DEBUG */
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -10,7 +10,12 @@
*/
#include <stdio.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -39,9 +43,9 @@ struct read_bb_record {
#pragma argsused
#endif
static int mark_bad_block(ext2_filsys fs, blk_t *block_nr,
int blockcnt, void *private)
int blockcnt, void *priv_data)
{
struct read_bb_record *rb = (struct read_bb_record *) private;
struct read_bb_record *rb = (struct read_bb_record *) priv_data;
if (blockcnt < 0)
return 0;

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -15,7 +15,11 @@
#endif
#include <time.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -23,7 +23,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -22,7 +22,11 @@
#include <errno.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -22,7 +22,11 @@
#include <errno.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -22,7 +22,11 @@
#include <errno.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -25,7 +25,11 @@
#include <sys/types.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -15,7 +15,11 @@
#include <unistd.h>
#endif
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
@ -34,9 +38,9 @@ static int unlink_proc(struct ext2_dir_entry *dirent,
int offset,
int blocksize,
char *buf,
void *private)
void *priv_data)
{
struct link_struct *ls = (struct link_struct *) private;
struct link_struct *ls = (struct link_struct *) priv_data;
if (ls->name && (dirent->name_len != ls->namelen))
return 0;

View File

@ -17,7 +17,11 @@
#include <string.h>
#include <time.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"

View File

@ -17,7 +17,12 @@
#include <stdio.h>
#include <ctype.h>
#if EXT2_FLAT_INCLUDES
#include "ext2_fs.h"
#else
#include <linux/ext2_fs.h>
#endif
#include "ext2fs.h"
#include "../../version.h"