Many files:
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++.
unix.c (sync_disk): Remove sync_disk and calls to that function,
since ext2fs_close() now takes care of this.
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.
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 3413db6..bee6f1e 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,23 @@
+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
diff --git a/e2fsck/badblocks.c b/e2fsck/badblocks.c
index b9b7cca..f3adc3c 100644
--- a/e2fsck/badblocks.c
+++ b/e2fsck/badblocks.c
@@ -14,7 +14,7 @@
#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)
@@ -118,7 +118,7 @@
}
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;
diff --git a/e2fsck/dirinfo.c b/e2fsck/dirinfo.c
index 2ab4a94..d2dca59 100644
--- a/e2fsck/dirinfo.c
+++ b/e2fsck/dirinfo.c
@@ -29,9 +29,10 @@
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) {
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index d83c8cb..b8eeb1b 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -23,9 +23,15 @@
#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
diff --git a/e2fsck/ehandler.c b/e2fsck/ehandler.c
index b370756..9f1a0bc 100644
--- a/e2fsck/ehandler.c
+++ b/e2fsck/ehandler.c
@@ -29,10 +29,10 @@
{
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
@@ -72,10 +72,10 @@
{
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
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 9ccde39..966c7e9 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -51,10 +51,10 @@
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);
@@ -64,7 +64,7 @@
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 {
@@ -200,9 +200,11 @@
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);
@@ -213,8 +215,8 @@
}
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;
@@ -493,14 +495,15 @@
* 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);
@@ -789,7 +792,7 @@
int blockcnt,
blk_t ref_block,
int ref_offset,
- void *private)
+ void *priv_data)
{
struct process_block_struct *p;
struct problem_context *pctx;
@@ -798,7 +801,7 @@
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;
@@ -914,7 +917,7 @@
int blockcnt,
blk_t ref_block,
int ref_offset,
- void *private)
+ void *priv_data)
{
struct process_block_struct *p;
blk_t blk = *block_nr;
@@ -926,7 +929,7 @@
if (!blk)
return 0;
- p = (struct process_block_struct *) private;
+ p = (struct process_block_struct *) priv_data;
ctx = p->ctx;
pctx = p->pctx;
@@ -1248,7 +1251,7 @@
*/
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)
@@ -1261,7 +1264,7 @@
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;
@@ -1272,7 +1275,7 @@
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;
@@ -1281,7 +1284,7 @@
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;
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index fbd43ee..df787e8 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -88,7 +88,7 @@
};
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);
@@ -198,7 +198,7 @@
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;
@@ -232,7 +232,7 @@
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;
@@ -241,7 +241,7 @@
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)) {
@@ -253,7 +253,8 @@
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;
@@ -298,11 +299,13 @@
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;
@@ -380,8 +383,9 @@
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;
@@ -479,12 +483,13 @@
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)
@@ -551,12 +556,12 @@
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;
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 85a857b..38d4424 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -51,14 +51,14 @@
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;
@@ -98,8 +98,8 @@
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
@@ -266,7 +266,7 @@
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;
@@ -276,11 +276,12 @@
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;
@@ -527,9 +528,9 @@
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;
@@ -765,10 +766,11 @@
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;
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 300d52e..817bf08 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -533,9 +533,9 @@
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;
@@ -607,9 +607,9 @@
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;
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index 3afd2ed..7215a58 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -90,7 +90,7 @@
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 <
@@ -223,10 +223,10 @@
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)) ||
diff --git a/e2fsck/super.c b/e2fsck/super.c
index a0a2f19..5c9df00 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -60,11 +60,11 @@
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);
diff --git a/e2fsck/swapfs.c b/e2fsck/swapfs.c
index 209a57a..31c0d9f 100644
--- a/e2fsck/swapfs.c
+++ b/e2fsck/swapfs.c
@@ -30,11 +30,11 @@
* 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);
@@ -125,8 +125,8 @@
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,
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 7c27a2a..b6e68ff 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -183,14 +183,6 @@
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
@@ -252,7 +244,8 @@
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);
@@ -318,7 +311,7 @@
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");
@@ -469,7 +462,6 @@
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,
@@ -525,7 +517,7 @@
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,
@@ -659,7 +651,6 @@
e2fsck_write_bitmaps(ctx);
ext2fs_close(fs);
- sync_disks();
#ifdef RESOURCE_TRACK
if (ctx->options & E2F_OPT_TIME)