+Sat Jan 17 13:02:16 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * e2fsck.h: If EXT2_FLAT_INCLUDES is defined, then assume all of
+ the ext2-specific header files are in a flat directory.
+
+ * dirinfo.c, ehandler.c, pass1.c, pass1b.c, pass2.c, pass5.c,
+ super.c, swapfs.c, unix.c: Explicitly cast all assignments
+ from void * to be compatible with C++.
+
+Tue Jan 6 11:30:24 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * unix.c (sync_disk): Remove sync_disk and calls to that function,
+ since ext2fs_close() now takes care of this.
+
+Mon Dec 29 14:45:42 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * pass1.c, pass1b.c, pass2.c, pass3.c, swapfs, badblocks.c,
+ ehandler.c, unix.c: Change use of private to be priv_data,
+ to avoid C++ reserved name clash.
+
Fri Nov 28 09:30:26 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
* dirinfo.c (e2fsck_add_dir_info): Use ext2fs_get_num_dirs instead
#include "e2fsck.h"
static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt,
- void *private);
+ void *priv_data);
static void invalid_block(ext2_filsys fs, blk_t blk)
}
static int check_bb_inode_blocks(ext2_filsys fs, blk_t *block_nr, int blockcnt,
- void *private)
+ void *priv_data)
{
if (!*block_nr)
return 0;
if (retval)
num_dirs = 1024; /* Guess */
ctx->dir_info_size = num_dirs + 10;
- ctx->dir_info = e2fsck_allocate_memory(ctx,
- ctx->dir_info_size * sizeof (struct dir_info),
- "directory map");
+ ctx->dir_info = (struct dir_info *)
+ e2fsck_allocate_memory(ctx, ctx->dir_info_size
+ * sizeof (struct dir_info),
+ "directory map");
}
if (ctx->dir_info_count >= ctx->dir_info_size) {
#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h>
#endif
-#include <linux/ext2_fs.h>
+#if EXT2_FLAT_INCLUDES
+#include "ext2_fs.h"
+#include "ext2fs.h"
+#else
+#include <linux/ext2_fs.h>
#include "ext2fs/ext2fs.h"
+#endif
+
/* Everything is STDC, these days */
#define NOARGS void
{
int i;
char *p;
- ext2_filsys fs = channel->app_data;
+ ext2_filsys fs = (ext2_filsys) channel->app_data;
e2fsck_t ctx;
- ctx = fs->private;
+ ctx = (e2fsck_t) fs->priv_data;
/*
* If more than one block was read, try reading each block
{
int i;
const char *p;
- ext2_filsys fs = channel->app_data;
+ ext2_filsys fs = (ext2_filsys) channel->app_data;
e2fsck_t ctx;
- ctx = fs->private;
+ ctx = (e2fsck_t) fs->priv_data;
/*
* If more than one block was written, try writing each block
static int process_block(ext2_filsys fs, blk_t *blocknr,
int blockcnt, blk_t ref_blk,
- int ref_offset, void *private);
+ int ref_offset, void *priv_data);
static int process_bad_block(ext2_filsys fs, blk_t *block_nr,
int blockcnt, blk_t ref_blk,
- int ref_offset, void *private);
+ int ref_offset, void *priv_data);
static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
char *block_buf);
static void mark_table_blocks(e2fsck_t ctx);
static void process_inodes(e2fsck_t ctx, char *block_buf);
static int process_inode_cmp(const void *a, const void *b);
static errcode_t scan_callback(ext2_filsys fs, ext2_inode_scan scan,
- dgrp_t group, void * private);
+ dgrp_t group, void * priv_data);
/* static char *describe_illegal_block(ext2_filsys fs, blk_t block); */
struct process_block_struct {
ctx->flags |= E2F_FLAG_ABORT;
return;
}
- inodes_to_process = e2fsck_allocate_memory(ctx,
- ctx->process_inode_size * sizeof(struct process_inode_block),
- "array of inodes to process");
+ inodes_to_process = (struct process_inode_block *)
+ e2fsck_allocate_memory(ctx,
+ (ctx->process_inode_size *
+ sizeof(struct process_inode_block)),
+ "array of inodes to process");
process_inode_count = 0;
pctx.errcode = ext2fs_init_dblist(fs, 0);
}
mark_table_blocks(ctx);
- block_buf = e2fsck_allocate_memory(ctx, fs->blocksize * 3,
- "block interate buffer");
+ block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 3,
+ "block interate buffer");
fs->get_blocks = pass1_get_blocks;
fs->check_directory = pass1_check_directory;
fs->read_inode = pass1_read_inode;
* glock group, call process_inodes.
*/
static errcode_t scan_callback(ext2_filsys fs, ext2_inode_scan scan,
- dgrp_t group, void * private)
+ dgrp_t group, void * priv_data)
{
- struct scan_callback_struct *scan_struct = private;
+ struct scan_callback_struct *scan_struct;
e2fsck_t ctx;
+ scan_struct = (struct scan_callback_struct *) priv_data;
ctx = scan_struct->ctx;
- process_inodes((e2fsck_t) fs->private, scan_struct->block_buf);
+ process_inodes((e2fsck_t) fs->priv_data, scan_struct->block_buf);
if (ctx->progress)
(ctx->progress)(ctx, 1, group+1, ctx->fs->group_desc_count);
int blockcnt,
blk_t ref_block,
int ref_offset,
- void *private)
+ void *priv_data)
{
struct process_block_struct *p;
struct problem_context *pctx;
int problem = 0;
e2fsck_t ctx;
- p = (struct process_block_struct *) private;
+ p = (struct process_block_struct *) priv_data;
pctx = p->pctx;
ctx = p->ctx;
int blockcnt,
blk_t ref_block,
int ref_offset,
- void *private)
+ void *priv_data)
{
struct process_block_struct *p;
blk_t blk = *block_nr;
if (!blk)
return 0;
- p = (struct process_block_struct *) private;
+ p = (struct process_block_struct *) priv_data;
ctx = p->ctx;
pctx = p->pctx;
*/
errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks)
{
- e2fsck_t ctx = fs->private;
+ e2fsck_t ctx = (e2fsck_t) fs->priv_data;
int i;
if (ino != ctx->stashed_ino)
errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino, struct ext2_inode *inode)
{
- e2fsck_t ctx = fs->private;
+ e2fsck_t ctx = (e2fsck_t) fs->priv_data;
if (ino != ctx->stashed_ino)
return EXT2_ET_CALLBACK_NOTHANDLED;
errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino,
struct ext2_inode *inode)
{
- e2fsck_t ctx = fs->private;
+ e2fsck_t ctx = (e2fsck_t) fs->priv_data;
if (ino == ctx->stashed_ino)
*ctx->stashed_inode = *inode;
errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino)
{
- e2fsck_t ctx = fs->private;
+ e2fsck_t ctx = (e2fsck_t) fs->priv_data;
if (ino != ctx->stashed_ino)
return EXT2_ET_CALLBACK_NOTHANDLED;
};
static int process_pass1b_block(ext2_filsys fs, blk_t *blocknr,
- int blockcnt, void *private);
+ int blockcnt, void *priv_data);
static void delete_file(e2fsck_t ctx, struct dup_inode *dp,
char *block_buf);
static int clone_file(e2fsck_t ctx, struct dup_inode *dp, char* block_buf);
process_pass1b_block, &pb);
if (pb.dup_blocks) {
end_problem_latch(ctx, PR_LATCH_DBLOCK);
- dp = e2fsck_allocate_memory(ctx,
+ dp = (struct dup_inode *) e2fsck_allocate_memory(ctx,
sizeof(struct dup_inode),
"duplicate inode record");
dp->ino = ino;
int process_pass1b_block(ext2_filsys fs,
blk_t *block_nr,
int blockcnt,
- void *private)
+ void *priv_data)
{
struct process_block_struct *p;
struct dup_block *dp, *q, *r;
if (!*block_nr)
return 0;
- p = (struct process_block_struct *) private;
+ p = (struct process_block_struct *) priv_data;
ctx = p->ctx;
if (ext2fs_test_block_bitmap(ctx->block_dup_map, *block_nr)) {
p->dup_blocks++;
ext2fs_mark_block_bitmap(ctx->block_dup_map, *block_nr);
ext2fs_mark_inode_bitmap(inode_dup_map, p->ino);
- dp = e2fsck_allocate_memory(ctx, sizeof(struct dup_block),
+ dp = (struct dup_block *) e2fsck_allocate_memory(ctx,
+ sizeof(struct dup_block),
"duplicate block record");
dp->block = *block_nr;
dp->ino = p->ino;
static int search_dirent_proc(ino_t dir, int entry,
struct ext2_dir_entry *dirent,
int offset, int blocksize,
- char *buf, void *private)
+ char *buf, void *priv_data)
{
- struct search_dir_struct *sd = private;
+ struct search_dir_struct *sd;
struct dup_inode *p;
-
+
+ sd = (struct search_dir_struct *) priv_data;
+
if (dirent->inode > sd->max_inode)
/* Should abort this inode, but not everything */
return 0;
pctx.num = dup_inode_count;
fix_problem(ctx, PR_1D_NUM_DUP_INODES, &pctx);
- shared = e2fsck_allocate_memory(ctx, sizeof(ino_t) * dup_inode_count,
- "Shared inode list");
+ shared = (ino_t *) e2fsck_allocate_memory(ctx,
+ sizeof(ino_t) * dup_inode_count,
+ "Shared inode list");
for (p = dup_ino; p; p = p->next) {
shared_len = 0;
file_ok = 1;
static int delete_file_block(ext2_filsys fs,
blk_t *block_nr,
int blockcnt,
- void *private)
+ void *priv_data)
{
- struct process_block_struct *pb = private;
+ struct process_block_struct *pb;
struct dup_block *p;
e2fsck_t ctx;
+ pb = (struct process_block_struct *) priv_data;
ctx = pb->ctx;
if (!*block_nr)
static int clone_file_block(ext2_filsys fs,
blk_t *block_nr,
int blockcnt,
- void *private)
+ void *priv_data)
{
struct dup_block *p;
blk_t new_block;
errcode_t retval;
- struct clone_struct *cs = (struct clone_struct *) private;
+ struct clone_struct *cs = (struct clone_struct *) priv_data;
e2fsck_t ctx;
ctx = cs->ctx;
static int process_bad_inode(e2fsck_t ctx, ino_t dir, ino_t ino);
static int check_dir_block(ext2_filsys fs,
struct ext2_db_entry *dir_blocks_info,
- void *private);
+ void *priv_data);
static int allocate_dir_block(e2fsck_t ctx,
struct ext2_db_entry *dir_blocks_info,
char *buf, struct problem_context *pctx);
static int update_dir_block(ext2_filsys fs,
blk_t *block_nr,
int blockcnt,
- void *private);
+ void *priv_data);
struct check_dir_struct {
char *buf;
ctx->flags |= E2F_FLAG_ABORT;
return;
}
- buf = e2fsck_allocate_memory(ctx, fs->blocksize,
- "directory scan buffer");
+ buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize,
+ "directory scan buffer");
/*
* Set up the parent pointer for the root directory, if
static int check_dir_block(ext2_filsys fs,
struct ext2_db_entry *db,
- void *private)
+ void *priv_data)
{
struct dir_info *subdir, *dir;
struct ext2_dir_entry *dirent;
blk_t block_nr = db->blk;
ino_t ino = db->ino;
__u16 links;
- struct check_dir_struct *cd = private;
+ struct check_dir_struct *cd;
char *buf;
e2fsck_t ctx;
int problem;
+ cd = (struct check_dir_struct *) priv_data;
buf = cd->buf;
ctx = cd->ctx;
static int deallocate_inode_block(ext2_filsys fs,
blk_t *block_nr,
int blockcnt,
- void *private)
+ void *priv_data)
{
- e2fsck_t ctx = (e2fsck_t) private;
+ e2fsck_t ctx = (e2fsck_t) priv_data;
if (!*block_nr)
return 0;
static int update_dir_block(ext2_filsys fs,
blk_t *block_nr,
int blockcnt,
- void *private)
+ void *priv_data)
{
- struct ext2_db_entry *db = private;
+ struct ext2_db_entry *db;
+ db = (struct ext2_db_entry *) priv_data;
if (db->blockcnt == blockcnt) {
*block_nr = db->blk;
return BLOCK_CHANGED;
int offset,
int blocksize,
char *buf,
- void *private)
+ void *priv_data)
{
- struct fix_dotdot_struct *fp = (struct fix_dotdot_struct *) private;
+ struct fix_dotdot_struct *fp = (struct fix_dotdot_struct *) priv_data;
errcode_t retval;
struct problem_context pctx;
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;
errcode_t retval;
clear_problem_context(&pctx);
- free_array = e2fsck_allocate_memory(ctx,
+ free_array = (int *) e2fsck_allocate_memory(ctx,
fs->group_desc_count * sizeof(int), "free block count array");
if ((fs->super->s_first_data_block <
int problem, fixit;
clear_problem_context(&pctx);
- free_array = e2fsck_allocate_memory(ctx,
+ free_array = (int *) e2fsck_allocate_memory(ctx,
fs->group_desc_count * sizeof(int), "free inode count array");
- dir_array = e2fsck_allocate_memory(ctx,
+ dir_array = (int *) e2fsck_allocate_memory(ctx,
fs->group_desc_count * sizeof(int), "directory count array");
if ((1 < ext2fs_get_inode_bitmap_start(ctx->inode_used_map)) ||
blk_t should_be;
struct problem_context pctx;
- ctx->invalid_inode_bitmap_flag = e2fsck_allocate_memory(ctx,
+ ctx->invalid_inode_bitmap_flag = (int *) e2fsck_allocate_memory(ctx,
sizeof(int) * fs->group_desc_count, "invalid_inode_bitmap");
- ctx->invalid_block_bitmap_flag = e2fsck_allocate_memory(ctx,
+ ctx->invalid_block_bitmap_flag = (int *) e2fsck_allocate_memory(ctx,
sizeof(int) * fs->group_desc_count, "invalid_block_bitmap");
- ctx->invalid_inode_table_flag = e2fsck_allocate_memory(ctx,
+ ctx->invalid_inode_table_flag = (int *) e2fsck_allocate_memory(ctx,
sizeof(int) * fs->group_desc_count, "invalid_inode_table");
clear_problem_context(&pctx);
* write them out.
*/
static int swap_block(ext2_filsys fs, blk_t *block_nr, int blockcnt,
- void *private)
+ void *priv_data)
{
errcode_t retval;
- struct swap_block_struct *sb = (struct swap_block_struct *) private;
+ struct swap_block_struct *sb = (struct swap_block_struct *) priv_data;
if (sb->isdir && (blockcnt >= 0) && *block_nr) {
retval = ext2fs_read_dir_block(fs, *block_nr, sb->dir_buf);
ctx->flags |= E2F_FLAG_ABORT;
return;
}
- block_buf = e2fsck_allocate_memory(ctx, fs->blocksize * 4,
- "block interate buffer");
+ block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 4,
+ "block interate buffer");
for (group = 0; group < fs->group_desc_count; group++) {
retval = io_channel_read_blk(fs->io,
fs->group_desc[group].bg_inode_table,
return;
}
-static void sync_disks(NOARGS)
-{
- sync();
- sync();
- sleep(1);
- sync();
-}
-
/*
* This routine checks to see if a filesystem can be skipped; if so,
* it will exit with E2FSCK_OK. Under some conditions it will print a
if (oldpath) {
char *newpath;
- newpath = malloc(sizeof (PATH_SET) + 1 + strlen (oldpath));
+ newpath = (char *) malloc(sizeof (PATH_SET) + 1 +
+ strlen (oldpath));
if (!newpath)
fatal_error(ctx, "Couldn't malloc() newpath");
strcpy (newpath, PATH_SET);
case 'L':
replace_bad_blocks++;
case 'l':
- bad_blocks_file = malloc(strlen(optarg)+1);
+ bad_blocks_file = (char *) malloc(strlen(optarg)+1);
if (!bad_blocks_file)
fatal_error(ctx,
"Couldn't malloc bad_blocks_file");
io_ptr = test_io_manager;
test_io_backing_manager = unix_io_manager;
#endif
- sync_disks();
flags = (ctx->options & E2F_OPT_READONLY) ? 0 : EXT2_FLAG_RW;
if (ctx->superblock && blocksize) {
retval = ext2fs_open(ctx->filesystem_name, flags,
exit(FSCK_ERROR);
}
ctx->fs = fs;
- fs->private = ctx;
+ fs->priv_data = ctx;
#ifdef EXT2_CURRENT_REV
if (fs->super->s_rev_level > E2FSCK_CURRENT_REV) {
com_err(ctx->program_name, EXT2_ET_REV_TOO_HIGH,
e2fsck_write_bitmaps(ctx);
ext2fs_close(fs);
- sync_disks();
#ifdef RESOURCE_TRACK
if (ctx->options & E2F_OPT_TIME)