From 5ba23cb149f2ff629446fb8cb5f1012c05f7a4f4 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 11 Jan 2001 19:15:02 +0000 Subject: [PATCH] ChangeLog, e2fsck.h, flushb.c, iscan.c, unix.c: iscan.c, unix.c, e2fsck.h: Don't use NOARGS, and use ext2fs_sync_device() instead of using BLKFLSBUF. flushb.c: Don't use NOARGS anymore; everything is STDC these days. ChangeLog, pass1.c: pass1.c (process_block): Remove dead code which was never getting executed. --- e2fsck/ChangeLog | 8 ++++++++ e2fsck/e2fsck.h | 8 -------- e2fsck/flushb.c | 9 +-------- e2fsck/iscan.c | 16 +++------------- e2fsck/pass1.c | 2 -- e2fsck/unix.c | 18 +++--------------- 6 files changed, 15 insertions(+), 46 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 9fe5d3e..c5f4d16 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,5 +1,13 @@ 2001-01-11 + * pass1.c (process_block): Remove dead code which was never + getting executed. + + * iscan.c, unix.c, e2fsck.h: Don't use NOARGS, and use + ext2fs_sync_device() instead of using BLKFLSBUF. + + * flushb.c: Don't use NOARGS anymore; everything is STDC these days. + * dirinfo.c, e2fsck.h, emptydir.c, iscan.c, jfs_user.h, journal.c, message.c, pass1.c, pass1b.c, pass2.c, pass3.c, pass4.c, pass5.c, problem.h, scantest.c, super.c, swapfs.c: Change diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index 5ffcd59..1c7ecf9 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -49,14 +49,6 @@ #define N_(a) a #endif -/* For Linux/i386, define BLKFLSBUF */ -#if (!defined(BLKFLSBUF) && defined(__i386__)) -#define BLKFLSBUF 0x1261 /* flush buffer cache */ -#endif - -/* Everything is STDC, these days */ -#define NOARGS void - /* * Exit codes used by fsck-type programs */ diff --git a/e2fsck/flushb.c b/e2fsck/flushb.c index c260bf6..16389b2 100644 --- a/e2fsck/flushb.c +++ b/e2fsck/flushb.c @@ -31,13 +31,6 @@ #include #include "../misc/nls-enable.h" -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif - /* For Linux/i386, define BLKFLSBUF */ #if (!defined(BLKFLSBUF) && defined(__i386__)) #define BLKFLSBUF 0x1261 /* flush buffer cache */ @@ -45,7 +38,7 @@ const char *progname; -static void usage(NOARGS) +static void usage(void) { fprintf(stderr, _("Usage: %s disk\n"), progname); exit(1); diff --git a/e2fsck/iscan.c b/e2fsck/iscan.c index 5869d6d..8f4b255 100644 --- a/e2fsck/iscan.c +++ b/e2fsck/iscan.c @@ -38,7 +38,7 @@ int invalid_bitmaps = 0; struct resource_track global_rtrack; -static void usage(NOARGS) +static void usage(void) { fprintf(stderr, _("Usage: %s [-F] [-I inode_buffer_blocks] device\n"), @@ -63,12 +63,7 @@ static void PRS(int argc, char *argv[]) while ((c = getopt (argc, argv, "FI")) != EOF) switch (c) { case 'F': -#ifdef BLKFLSBUF flush = 1; -#else - fprintf(stderr, _("-F not supported")); - exit(1); -#endif break; case 'I': inode_buffer_blocks = atoi(optarg); @@ -78,7 +73,6 @@ static void PRS(int argc, char *argv[]) } device_name = argv[optind]; if (flush) { -#ifdef BLKFLSBUF int fd = open(device_name, O_RDONLY, 0); if (fd < 0) { @@ -86,16 +80,12 @@ static void PRS(int argc, char *argv[]) _("while opening %s for flushing"), device_name); exit(FSCK_ERROR); } - if (ioctl(fd, BLKFLSBUF, 0) < 0) { - com_err("BLKFLSBUF", errno, + if ((retval = ext2fs_sync_device(fd, 1))) { + com_err("ext2fs_sync_device", retval, _("while trying to flush %s"), device_name); exit(FSCK_ERROR); } close(fd); -#else - fprintf(stderr, _("BLKFLSBUF not supported")); - exit(1); -#endif /* BLKFLSBUF */ } } diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index cb4e583..90530c7 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1107,8 +1107,6 @@ static int process_block(ext2_filsys fs, goto mark_dir; } else return 0; - pctx->blk = 0; - pctx->blkcount = -1; } mark_block_used(ctx, blk); diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 34984e9..4e5925c 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -393,7 +393,7 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass, #define PATH_SET "PATH=/sbin" -static void reserve_stdio_fds(NOARGS) +static void reserve_stdio_fds(void) { int fd; @@ -543,11 +543,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) force = 1; break; case 'F': -#ifdef BLKFLSBUF flush = 1; -#else - fatal_error(ctx, _("-F not supported")); -#endif break; case 'v': verbose = 1; @@ -579,7 +575,6 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) !cflag && !swapfs) ctx->options |= E2F_OPT_READONLY; ctx->filesystem_name = argv[optind]; -#ifdef BLKFLSBUF if (flush) { int fd = open(ctx->filesystem_name, O_RDONLY, 0); @@ -589,21 +584,14 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) ctx->filesystem_name); fatal_error(ctx, 0); } - if (fsync(fd) < 0) { - com_err("fsync", errno, - _("while trying to flush %s"), - ctx->filesystem_name); - fatal_error(ctx, 0); - } - if (ioctl(fd, BLKFLSBUF, 0) < 0) { - com_err("BLKFLSBUF", errno, + if ((retval == ext2fs_sync_device(fd, 1))) { + com_err("ext2fs_sync_device", retval, _("while trying to flush %s"), ctx->filesystem_name); fatal_error(ctx, 0); } close(fd); } -#endif /* BLKFLSBUF */ if (swapfs) { if (cflag || bad_blocks_file) { fprintf(stderr, _("Incompatible options not " -- 1.8.3.1