2001-01-11 <tytso@snap.thunk.org>
+ * 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
#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
*/
#include <sys/ioctl.h>
#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 */
const char *progname;
-static void usage(NOARGS)
+static void usage(void)
{
fprintf(stderr, _("Usage: %s disk\n"), progname);
exit(1);
struct resource_track global_rtrack;
-static void usage(NOARGS)
+static void usage(void)
{
fprintf(stderr,
_("Usage: %s [-F] [-I inode_buffer_blocks] device\n"),
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);
}
device_name = argv[optind];
if (flush) {
-#ifdef BLKFLSBUF
int fd = open(device_name, O_RDONLY, 0);
if (fd < 0) {
_("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 */
}
}
goto mark_dir;
} else
return 0;
- pctx->blk = 0;
- pctx->blkcount = -1;
}
mark_block_used(ctx, blk);
#define PATH_SET "PATH=/sbin"
-static void reserve_stdio_fds(NOARGS)
+static void reserve_stdio_fds(void)
{
int fd;
force = 1;
break;
case 'F':
-#ifdef BLKFLSBUF
flush = 1;
-#else
- fatal_error(ctx, _("-F not supported"));
-#endif
break;
case 'v':
verbose = 1;
!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);
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 "