summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ss/dll/jump.funcs (renamed from lib/ss/jump/jump.funcs)0
-rw-r--r--lib/ss/dll/jump.ignore0
-rw-r--r--lib/ss/dll/jump.import (renamed from lib/ss/jump/jump.import)0
-rw-r--r--lib/ss/dll/jump.params (renamed from lib/ss/jump/jump.params)0
-rw-r--r--lib/ss/dll/jump.undefs2
-rw-r--r--lib/ss/dll/jump.vars (renamed from lib/ss/jump/jump.vars)0
-rw-r--r--lib/ss/jump/jump.undefs2
-rw-r--r--lib/ss/ss_err.h29
-rw-r--r--lib/ss/ss_internal.h5
-rw-r--r--lib/ss/std_rqs.c2
-rw-r--r--lib/ss/test_ss.c4
-rw-r--r--misc/.depend149
-rw-r--r--misc/ChangeLog129
-rw-r--r--misc/Makefile90
-rw-r--r--misc/Makefile.in148
-rw-r--r--misc/badblocks.82
-rw-r--r--misc/badblocks.c48
-rw-r--r--misc/chattr.12
-rw-r--r--misc/chattr.c15
-rw-r--r--misc/dumpe2fs.87
-rw-r--r--misc/dumpe2fs.c12
-rw-r--r--misc/fsck.85
-rw-r--r--misc/fsck.c80
-rw-r--r--misc/lsattr.14
-rw-r--r--misc/lsattr.c27
-rw-r--r--misc/mke2fs.87
-rw-r--r--misc/mke2fs.c151
-rw-r--r--misc/mklost+found.85
-rw-r--r--misc/mklost+found.c2
-rw-r--r--misc/tune2fs.84
-rw-r--r--misc/tune2fs.c10
-rw-r--r--tests/ChangeLog16
-rw-r--r--tests/Makefile.in23
-rw-r--r--tests/README67
-rw-r--r--tests/defaults/f_script1
-rw-r--r--tests/f_badbblocks/expect.120
-rw-r--r--tests/f_badbblocks/expect.27
-rw-r--r--tests/f_badbblocks/image.gzbin0 -> 376 bytes
-rw-r--r--tests/f_badbblocks/name1
-rw-r--r--tests/f_baddir/expect.139
-rw-r--r--tests/f_baddir/expect.27
-rw-r--r--tests/f_baddir/image.gzbin0 -> 14360 bytes
-rw-r--r--tests/f_baddir/name1
-rw-r--r--tests/f_baddotdir/expect.148
-rw-r--r--tests/f_baddotdir/expect.27
-rw-r--r--tests/f_baddotdir/image.gzbin0 -> 499 bytes
-rw-r--r--tests/f_baddotdir/name1
-rw-r--r--tests/f_badinode/expect.125
-rw-r--r--tests/f_badinode/expect.27
-rw-r--r--tests/f_badinode/image.gzbin0 -> 1037 bytes
-rw-r--r--tests/f_badinode/name1
-rw-r--r--tests/f_badlkcnt/expect.117
-rw-r--r--tests/f_badlkcnt/expect.27
-rw-r--r--tests/f_badlkcnt/image.gzbin0 -> 3826 bytes
-rw-r--r--tests/f_badlkcnt/name1
-rw-r--r--tests/f_badprimary/expect.125
-rw-r--r--tests/f_badprimary/expect.27
-rw-r--r--tests/f_badprimary/image.gzbin0 -> 374 bytes
-rw-r--r--tests/f_badprimary/name1
-rw-r--r--tests/f_badroot/expect.137
-rw-r--r--tests/f_badroot/expect.27
-rw-r--r--tests/f_badroot/image.gzbin0 -> 479 bytes
-rw-r--r--tests/f_badroot/name1
-rw-r--r--tests/f_badtable/expect.129
-rw-r--r--tests/f_badtable/expect.27
-rw-r--r--tests/f_badtable/image.gzbin0 -> 987 bytes
-rw-r--r--tests/f_badtable/name1
-rw-r--r--tests/f_bbfile/expect.144
-rw-r--r--tests/f_bbfile/expect.27
-rw-r--r--tests/f_bbfile/image.gzbin0 -> 5195 bytes
-rw-r--r--tests/f_bbfile/name1
-rw-r--r--tests/f_bitmaps/expect.113
-rw-r--r--tests/f_bitmaps/expect.27
-rw-r--r--tests/f_bitmaps/image.gzbin0 -> 687 bytes
-rw-r--r--tests/f_bitmaps/name1
-rw-r--r--tests/f_dirlink/expect.112
-rw-r--r--tests/f_dirlink/expect.27
-rw-r--r--tests/f_dirlink/image.gzbin0 -> 490 bytes
-rw-r--r--tests/f_dirlink/name1
-rw-r--r--tests/f_dup/expect.134
-rw-r--r--tests/f_dup/expect.27
-rw-r--r--tests/f_dup/image.gzbin0 -> 3744 bytes
-rw-r--r--tests/f_dup/name1
-rw-r--r--tests/f_dup2/expect.142
-rw-r--r--tests/f_dup2/expect.27
-rw-r--r--tests/f_dup2/image.gzbin0 -> 14589 bytes
-rw-r--r--tests/f_dup2/name1
-rw-r--r--tests/f_dupfsblks/expect.131
-rw-r--r--tests/f_dupfsblks/expect.27
-rw-r--r--tests/f_dupfsblks/image.gzbin0 -> 389 bytes
-rw-r--r--tests/f_dupfsblks/name1
-rw-r--r--tests/f_dupsuper/expect.121
-rw-r--r--tests/f_dupsuper/expect.27
-rw-r--r--tests/f_dupsuper/image.gzbin0 -> 5158 bytes
-rw-r--r--tests/f_dupsuper/name1
-rw-r--r--tests/f_end-bitmap/expect.114
-rw-r--r--tests/f_end-bitmap/expect.27
-rw-r--r--tests/f_end-bitmap/image.gzbin0 -> 3756 bytes
-rw-r--r--tests/f_end-bitmap/name2
-rw-r--r--tests/f_expand/expect.1587
-rw-r--r--tests/f_expand/expect.27
-rw-r--r--tests/f_expand/image.gzbin0 -> 13125 bytes
-rw-r--r--tests/f_expand/name1
-rw-r--r--tests/f_holedir/expect.131
-rw-r--r--tests/f_holedir/expect.27
-rw-r--r--tests/f_holedir/image.gzbin0 -> 345 bytes
-rw-r--r--tests/f_holedir/name1
-rw-r--r--tests/f_illbbitmap/expect.119
-rw-r--r--tests/f_illbbitmap/expect.27
-rw-r--r--tests/f_illbbitmap/image.gzbin0 -> 357 bytes
-rw-r--r--tests/f_illbbitmap/name1
-rw-r--r--tests/f_illibitmap/expect.116
-rw-r--r--tests/f_illibitmap/expect.27
-rw-r--r--tests/f_illibitmap/image.gzbin0 -> 360 bytes
-rw-r--r--tests/f_illibitmap/name1
-rw-r--r--tests/f_lotsbad/expect.146
-rw-r--r--tests/f_lotsbad/expect.27
-rw-r--r--tests/f_lotsbad/image.gzbin0 -> 3552 bytes
-rw-r--r--tests/f_lotsbad/name1
-rw-r--r--tests/f_lpf/expect.139
-rw-r--r--tests/f_lpf/expect.27
-rw-r--r--tests/f_lpf/image.gzbin0 -> 15342 bytes
-rw-r--r--tests/f_lpf/name1
-rw-r--r--tests/f_messy_inode/expect.133
-rw-r--r--tests/f_messy_inode/expect.27
-rw-r--r--tests/f_messy_inode/image.gzbin0 -> 3823 bytes
-rw-r--r--tests/f_messy_inode/name1
-rw-r--r--tests/f_mke2fs2b/expect.136
-rw-r--r--tests/f_mke2fs2b/expect.27
-rw-r--r--tests/f_mke2fs2b/image.gzbin0 -> 556 bytes
-rw-r--r--tests/f_mke2fs2b/name1
-rw-r--r--tests/f_noroot/expect.144
-rw-r--r--tests/f_noroot/expect.27
-rw-r--r--tests/f_noroot/image.gzbin0 -> 550 bytes
-rw-r--r--tests/f_noroot/name1
-rw-r--r--tests/f_okgroup/expect.17
-rw-r--r--tests/f_okgroup/expect.27
-rw-r--r--tests/f_okgroup/image.gzbin0 -> 8387 bytes
-rw-r--r--tests/f_okgroup/name1
-rw-r--r--tests/f_overfsblks/expect.116
-rw-r--r--tests/f_overfsblks/expect.27
-rw-r--r--tests/f_overfsblks/image.gzbin0 -> 351 bytes
-rw-r--r--tests/f_overfsblks/name1
-rw-r--r--tests/run_e2fsck72
-rw-r--r--tests/test_config9
-rw-r--r--tests/test_script43
146 files changed, 2361 insertions, 353 deletions
diff --git a/lib/ss/jump/jump.funcs b/lib/ss/dll/jump.funcs
index a8b08c62..a8b08c62 100644
--- a/lib/ss/jump/jump.funcs
+++ b/lib/ss/dll/jump.funcs
diff --git a/lib/ss/dll/jump.ignore b/lib/ss/dll/jump.ignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lib/ss/dll/jump.ignore
diff --git a/lib/ss/jump/jump.import b/lib/ss/dll/jump.import
index 53208d55..53208d55 100644
--- a/lib/ss/jump/jump.import
+++ b/lib/ss/dll/jump.import
diff --git a/lib/ss/jump/jump.params b/lib/ss/dll/jump.params
index 2947e285..2947e285 100644
--- a/lib/ss/jump/jump.params
+++ b/lib/ss/dll/jump.params
diff --git a/lib/ss/dll/jump.undefs b/lib/ss/dll/jump.undefs
new file mode 100644
index 00000000..56d1fda6
--- /dev/null
+++ b/lib/ss/dll/jump.undefs
@@ -0,0 +1,2 @@
+66885010 D __NEEDS_SHRLIB_libc_4
+66885028 D __NEEDS_SHRLIB_libet_1
diff --git a/lib/ss/jump/jump.vars b/lib/ss/dll/jump.vars
index 95cd8e47..95cd8e47 100644
--- a/lib/ss/jump/jump.vars
+++ b/lib/ss/dll/jump.vars
diff --git a/lib/ss/jump/jump.undefs b/lib/ss/jump/jump.undefs
deleted file mode 100644
index 1a2f89ac..00000000
--- a/lib/ss/jump/jump.undefs
+++ /dev/null
@@ -1,2 +0,0 @@
-66885010 D __NEEDS_SHRLIB_libc_4
-66885024 D __NEEDS_SHRLIB_libet_1
diff --git a/lib/ss/ss_err.h b/lib/ss/ss_err.h
deleted file mode 100644
index 02ab5073..00000000
--- a/lib/ss/ss_err.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * ss_err.h:
- * This file is automatically generated; please do not edit it.
- */
-#ifdef __STDC__
-#define NOARGS void
-#else
-#define NOARGS
-#define const
-#endif
-
-#define SS_ET_SUBSYSTEM_ABORTED (748800L)
-#define SS_ET_VERSION_MISMATCH (748801L)
-#define SS_ET_NULL_INV (748802L)
-#define SS_ET_NO_INFO_DIR (748803L)
-#define SS_ET_COMMAND_NOT_FOUND (748804L)
-#define SS_ET_LINE_ABORTED (748805L)
-#define SS_ET_EOF (748806L)
-#define SS_ET_PERMISSION_DENIED (748807L)
-#define SS_ET_TABLE_NOT_FOUND (748808L)
-#define SS_ET_NO_HELP_FILE (748809L)
-#define SS_ET_ESCAPE_DISABLED (748810L)
-#define SS_ET_UNIMPLEMENTED (748811L)
-extern void initialize_ss_error_table (NOARGS);
-#define ERROR_TABLE_BASE_ss (748800L)
-
-/* for compatibility with older versions... */
-#define init_ss_err_tbl initialize_ss_error_table
-#define ss_err_base ERROR_TABLE_BASE_ss
diff --git a/lib/ss/ss_internal.h b/lib/ss/ss_internal.h
index fc4a2adb..388a3768 100644
--- a/lib/ss/ss_internal.h
+++ b/lib/ss/ss_internal.h
@@ -8,6 +8,7 @@
#define _ss_ss_internal_h __FILE__
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#ifdef __STDC__
@@ -107,10 +108,6 @@ void ss_page_stdin(NOARGS);
extern ss_data **_ss_table;
extern char *ss_et_msgs[];
-extern pointer malloc PROTOTYPE((unsigned));
-extern pointer realloc PROTOTYPE((pointer, unsigned));
-extern pointer calloc PROTOTYPE((unsigned, unsigned));
-
#ifdef USE_SIGPROCMASK
/* fake sigmask, sigblock, sigsetmask */
#include <signal.h>
diff --git a/lib/ss/std_rqs.c b/lib/ss/std_rqs.c
index d0f0ccba..704766d6 100644
--- a/lib/ss/std_rqs.c
+++ b/lib/ss/std_rqs.c
@@ -1,4 +1,4 @@
-/* std_rqs.c - automatically generated from std_rqs.ct */
+/* ./std_rqs.c - automatically generated from ./std_rqs.ct */
#include <ss/ss.h>
#ifndef __STDC__
diff --git a/lib/ss/test_ss.c b/lib/ss/test_ss.c
index ee9c087e..7b37ec47 100644
--- a/lib/ss/test_ss.c
+++ b/lib/ss/test_ss.c
@@ -9,8 +9,8 @@
* $Locker$
*
* $Log$
- * Revision 1.2 1997/04/26 13:34:09 tytso
- * Checkin of e2fsprogs 0.5b
+ * Revision 1.3 1997/04/26 13:58:24 tytso
+ * Checked in e2fsprogs 0.5c
*
* Revision 1.1 1993/06/03 12:31:25 tytso
* Initial revision
diff --git a/misc/.depend b/misc/.depend
index 9466333b..77a8bb7f 100644
--- a/misc/.depend
+++ b/misc/.depend
@@ -1,104 +1,107 @@
-badblocks.o : badblocks.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
+badblocks.o : ./badblocks.c /usr/include/errno.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/linux/errno.h /usr/include/fcntl.h /usr/include/sys/types.h /usr/include/linux/types.h \
- /usr/include/asm/types.h /usr/include/linux/fcntl.h /usr/include/getopt.h /usr/include/signal.h \
- /usr/include/linux/signal.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
- /usr/include/stdlib.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
- /usr/include/alloca.h /usr/include/string.h /usr/include/unistd.h /usr/include/posix_opt.h \
- /usr/include/gnu/types.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
- /usr/include/termios.h /usr/include/linux/termios.h /usr/include/linux/fd.h \
- /usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
- /usr/include/linux/wait.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
- /usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
- /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
- /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
- /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
- /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
- ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h
-chattr.o : chattr.c /usr/include/dirent.h /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/asm/types.h /usr/include/gnu/types.h /usr/include/linux/fcntl.h \
+ /usr/include/getopt.h /usr/include/signal.h /usr/include/linux/signal.h /usr/include/stdio.h \
+ /usr/include/libio.h /usr/include/_G_config.h /usr/include/stdlib.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
+ /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/string.h \
+ /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/confname.h /usr/include/sys/ioctl.h \
+ /usr/include/linux/ioctl.h /usr/include/termios.h /usr/include/linux/termios.h \
+ /usr/include/linux/fd.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
+ /usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/dirent.h \
+ /usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
+ /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
+ /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
+ /usr/include/linux/msdos_fs_i.h /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h \
+ /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
+ /usr/include/linux/sysv_fs_i.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+ ../lib/ext2fs/io.h
+chattr.o : ./chattr.c /usr/include/dirent.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
/usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
/usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
/usr/include/fcntl.h /usr/include/linux/fcntl.h /usr/include/getopt.h /usr/include/stdio.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/stdlib.h /usr/include/errno.h \
/usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
- /usr/include/alloca.h /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/sys/param.h \
- /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h \
- /usr/include/limits.h /usr/include/posix2_lim.h /usr/include/linux/param.h /usr/include/asm/param.h \
+ /usr/include/alloca.h /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/confname.h \
+ /usr/include/sys/param.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
+ /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
+ /usr/include/posix2_lim.h /usr/include/linux/param.h /usr/include/asm/param.h \
/usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/e2p/e2p.h \
- ../version.h
-dumpe2fs.o : dumpe2fs.c /usr/include/getopt.h /usr/include/fcntl.h /usr/include/features.h \
+ ./../version.h
+dumpe2fs.o : ./dumpe2fs.c /usr/include/getopt.h /usr/include/fcntl.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/sys/types.h /usr/include/linux/types.h \
- /usr/include/asm/types.h /usr/include/linux/fcntl.h /usr/include/stdio.h /usr/include/libio.h \
- /usr/include/_G_config.h /usr/include/stdlib.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
- /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
- /usr/include/alloca.h /usr/include/string.h /usr/include/unistd.h /usr/include/posix_opt.h \
- /usr/include/gnu/types.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
- ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
- ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h ../lib/e2p/e2p.h /usr/include/dirent.h \
- /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
- ../version.h
-fsck.o : fsck.c /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
+ /usr/include/asm/types.h /usr/include/gnu/types.h /usr/include/linux/fcntl.h \
+ /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/stdlib.h \
+ /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/errno.h /usr/include/linux/errno.h \
+ /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/string.h \
+ /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/confname.h /usr/include/linux/ext2_fs.h \
+ ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+ ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h ../lib/e2p/e2p.h \
+ /usr/include/dirent.h /usr/include/linux/limits.h /usr/include/linux/dirent.h \
+ /usr/include/posix1_lim.h ./../version.h
+fsck.o : ./fsck.c /usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
/usr/include/sys/wait.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/types.h \
/usr/include/waitflags.h /usr/include/linux/wait.h /usr/include/waitstatus.h \
/usr/include/endian.h /usr/include/bytesex.h /usr/include/sys/signal.h /usr/include/signal.h \
/usr/include/linux/signal.h /usr/include/sys/stat.h /usr/include/linux/stat.h \
- /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
- /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
- /usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
- /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/stdlib.h \
- /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
- /usr/include/alloca.h /usr/include/string.h /usr/include/mntent.h /usr/include/unistd.h \
- /usr/include/posix_opt.h /usr/include/getopt.h ../version.h fsck.h
-lsattr.o : lsattr.c /usr/include/dirent.h /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h \
+ /usr/include/limits.h /usr/include/posix1_lim.h /usr/include/linux/limits.h \
+ /usr/include/posix2_lim.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
+ /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/stdlib.h \
+ /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
+ /usr/include/alloca.h /usr/include/mntent.h /usr/include/unistd.h /usr/include/posix_opt.h \
+ /usr/include/confname.h /usr/include/malloc.h /usr/include/getopt.h ./../version.h \
+ ./fsck.h
+lsattr.o : ./lsattr.c /usr/include/dirent.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/gnu/types.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
/usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
/usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
/usr/include/errno.h /usr/include/linux/errno.h /usr/include/fcntl.h /usr/include/linux/fcntl.h \
/usr/include/getopt.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
- /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/sys/param.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
- /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
- /usr/include/posix2_lim.h /usr/include/linux/param.h /usr/include/asm/param.h \
+ /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/confname.h /usr/include/sys/param.h \
+ /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h \
+ /usr/include/limits.h /usr/include/posix2_lim.h /usr/include/linux/param.h /usr/include/asm/param.h \
/usr/include/sys/stat.h /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h \
../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/e2p/e2p.h \
- ../version.h
-mke2fs.o : mke2fs.c /usr/include/string.h /usr/include/features.h /usr/include/sys/cdefs.h \
+ ./../version.h
+mke2fs.o : ./mke2fs.c /usr/include/string.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/fcntl.h /usr/include/sys/types.h \
- /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/linux/fcntl.h \
- /usr/include/ctype.h /usr/include/termios.h /usr/include/linux/termios.h /usr/include/time.h \
- /usr/include/getopt.h /usr/include/unistd.h /usr/include/posix_opt.h /usr/include/gnu/types.h \
- /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
- /usr/include/alloca.h /usr/include/mntent.h /usr/include/stdio.h /usr/include/libio.h \
- /usr/include/_G_config.h /usr/include/malloc.h /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h \
- /usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
- /usr/include/linux/wait.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
- /usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
- /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
- /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
- /usr/include/linux/umsdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
- /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
- /usr/include/linux/ext2_fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
- ../lib/ext2fs/ext2fs.h ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h \
- ../version.h
-mklost+found.o : mklost+found.c /usr/include/errno.h /usr/include/features.h \
+ /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/gnu/types.h \
+ /usr/include/linux/fcntl.h /usr/include/ctype.h /usr/include/termios.h /usr/include/linux/termios.h \
+ /usr/include/time.h /usr/include/getopt.h /usr/include/unistd.h /usr/include/posix_opt.h \
+ /usr/include/confname.h /usr/include/stdlib.h /usr/include/errno.h /usr/include/linux/errno.h \
+ /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h /usr/include/alloca.h /usr/include/mntent.h \
+ /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/malloc.h \
+ /usr/include/sys/ioctl.h /usr/include/linux/ioctl.h /usr/include/linux/fs.h \
+ /usr/include/linux/linkage.h /usr/include/linux/limits.h /usr/include/linux/wait.h \
+ /usr/include/linux/dirent.h /usr/include/linux/vfs.h /usr/include/linux/net.h \
+ /usr/include/linux/socket.h /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h \
+ /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h \
+ /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h /usr/include/linux/umsdos_fs_i.h \
+ /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h \
+ /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h /usr/include/linux/ext2_fs.h \
+ ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/ext2fs.h \
+ ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h ./../version.h
+mklost+found.o : ./mklost+found.c /usr/include/errno.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/linux/errno.h /usr/include/fcntl.h /usr/include/sys/types.h \
- /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/linux/fcntl.h \
- /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/string.h \
- /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h /usr/include/posix_opt.h \
- /usr/include/gnu/types.h /usr/include/sys/param.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
+ /usr/include/linux/types.h /usr/include/asm/types.h /usr/include/gnu/types.h \
+ /usr/include/linux/fcntl.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
+ /usr/include/string.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h /usr/include/unistd.h \
+ /usr/include/posix_opt.h /usr/include/confname.h /usr/include/sys/param.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/limits.h \
/usr/lib/gcc-lib/i486-linux/2.5.8/include/syslimits.h /usr/include/limits.h \
/usr/include/posix1_lim.h /usr/include/linux/limits.h /usr/include/posix2_lim.h \
/usr/include/linux/param.h /usr/include/asm/param.h /usr/include/sys/stat.h \
- /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h ../version.h
-tune2fs.o : tune2fs.c /usr/include/fcntl.h /usr/include/features.h /usr/include/sys/cdefs.h \
+ /usr/include/linux/stat.h /usr/include/linux/ext2_fs.h ./../version.h
+tune2fs.o : ./tune2fs.c /usr/include/fcntl.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/sys/types.h /usr/include/linux/types.h /usr/include/asm/types.h \
- /usr/include/linux/fcntl.h /usr/include/grp.h /usr/include/gnu/types.h /usr/include/stdio.h \
+ /usr/include/gnu/types.h /usr/include/linux/fcntl.h /usr/include/grp.h /usr/include/stdio.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stddef.h \
/usr/include/getopt.h /usr/include/pwd.h /usr/include/stdlib.h /usr/include/errno.h \
/usr/include/linux/errno.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/float.h \
/usr/include/alloca.h /usr/include/string.h /usr/include/time.h /usr/include/unistd.h \
- /usr/include/posix_opt.h /usr/include/linux/ext2_fs.h ../lib/ext2fs/ext2fs.h \
- ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h ../lib/ext2fs/io.h \
- ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h ../lib/e2p/e2p.h /usr/include/dirent.h \
- /usr/include/linux/limits.h /usr/include/linux/dirent.h /usr/include/posix1_lim.h \
- ../version.h
+ /usr/include/posix_opt.h /usr/include/confname.h /usr/include/linux/ext2_fs.h \
+ ../lib/ext2fs/ext2fs.h ../lib/et/com_err.h /usr/lib/gcc-lib/i486-linux/2.5.8/include/stdarg.h \
+ ../lib/ext2fs/io.h ../lib/ext2fs/ext2_err.h ../lib/ext2fs/bitops.h ../lib/e2p/e2p.h \
+ /usr/include/dirent.h /usr/include/linux/limits.h /usr/include/linux/dirent.h \
+ /usr/include/posix1_lim.h ./../version.h
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 9550ab86..e815ed5d 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,3 +1,132 @@
+Thu Oct 26 12:05:18 1995 <tytso@rsts-11.mit.edu>
+
+ * Makefile.in (install): Strip programs when they are installed.
+
+Fri Aug 18 15:10:40 1995 Theodore Y. Ts'o <tytso@dcl>
+
+ * mke2fs.c (PRS): Move call of check_mount() from main() to PRS(),
+ so we do the check to see if the filesystem is mounted
+ *before* we try to determine the size of the device.
+
+Wed Sep 6 23:34:07 1995 Remy Card <card@bbj>
+
+ * fsck.c (load_fs_info): Load the informations from /etc/fstab in
+ the same order.
+
+Thu Aug 17 22:33:09 1995 <tytso@rsts-11.mit.edu>
+
+ * mke2fs.c (check_mount): Use the new ext2fs_check_if_mounted()
+ function to determine if the device is mounted.
+
+ * mke2fs.c (PRS): Change call to use the new
+ ext2fs_get_device_size() function in order to determine
+ the size of the filesystem. Remove get_size() and
+ is_valid_offset(), which are no longer called.
+
+Fri Aug 11 08:26:24 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu>
+
+ * fsck.c (fsck_device): Make sure fstype has been set by the user
+ and that it does not begin with "no" and the user has
+ specified exactly one type before using it as the type to
+ check.
+
+Fri Aug 11 14:17:18 1995 Remy Card <card@bbj>
+
+ * badblocks.8:
+ * chattr.1:
+ * dumpe2fs.8:
+ * fsck.8:
+ * lsattr.1:
+ * mke2fs.8:
+ * mklost+found.8:
+ * tune2fs.8: Updated date and version number.
+
+Thu Aug 10 14:18:36 1995 Remy Card <card@bbj>
+
+ * tune2fs.c: Fixed a bug which prevented the use of user and group
+ names with the -g and -u options. Thanks to Jean Christophe
+ ANDRE <progfou@mycrob.cafard.freenix.fr>.
+
+ * mke2fs.8:
+ * tune2fs.8: Fixed a spelling error in Ted's name :-)
+
+Wed Aug 9 20:41:54 1995 Theodore Y. Ts'o <tytso@dcl>
+
+ * mke2fs.c (count_blocks): Divide the size by
+ EXT2_BLOCK_SIZE(&param), instead of assuming that the
+ blocksize is always 1024 bytes.
+
+Sat Aug 5 12:00:51 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu>
+
+ * mke2fs.c (PRS): Use malloc() instead of alloca() --- alloca() is
+ not portable!! In any case putenv() in some systems must
+ take a static character array or malloc()'ed memory;
+ passing memory allocated using alloca() to putenv() is not
+ advisable.
+
+ * chattr.c (chattr_dir_proc):
+ * lsattr.c (lsattr_dir_proc): Use malloc() instead of alloca() ---
+ alloca is not portable!
+
+ * fsck.c (fsck_device): If the filesystem type is specified by the
+ user using the -t option, let it override the type in
+ /etc/fstab.
+
+ * fsck.c (strdup): Don't build strdup() if the system defines it.
+
+Mon Jun 12 19:15:10 1995 Theodore Y. Ts'o (tytso@dcl)
+
+ * chattr.c, lsattr.c: Include <sys/types.h> for <dirent.h>'s
+ benefit.
+
+ * The $(UPROGS) go in bin, not sbin.
+
+ * badblocks.c, chattr.c, dumpe2fs.c, fsck.c, lsattr.c, mke2fs.c,
+ tune2fs.c: Don't include <getopt.h> if it doesn't exist.
+
+Mon Jun 12 16:36:04 1995 Theodore Y. Ts'o <tytso@dcl>
+
+ * badblocks.c, chattr.c, dumpe2fs.c, fsck.c, lsattr.c, mke2fs.c,
+ tune2fs.c: Only include getopt.h if HAVE_GETOPT_H is defined.
+
+Sat Jun 10 23:37:09 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu>
+
+ * chattr.c: Include errno.h, since we use errno
+
+ * fsck.c (load_fs_info): If HAVE_MNTENT_H is not defined,
+ explicitly initialize filesys_info to be NULL.
+
+ * mke2fs.c: Include the stdio.h and errno.h header files
+
+Thu Jun 8 13:25:23 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu>
+
+ * mke2fs.c: Only include <linux/fs.h> if we can.
+ (get_size): Don't try to use the BLKGETSIZE ioctl unless it's defined.
+ (check_mount): Only check to see if the device is mounted if
+ HAVE_MNTENT_H is defined (by configure).
+
+ * fsck.c (load_fs_info): Only try to get info about filesystems if
+ HAVE_MNTENT_H is defined (by configure).
+ (main): Allocate space for a new fsck_path instead of append to a
+ statically sized buffer.
+ (PRS): Use alloca to allocate the new path string, instead of
+ having a fixed size buffer (which was the wrong size anyway).
+
+ * chattr.c (chattr_dir_proc): Use alloca to allocate space for a
+ filename instead of using a fixed-size buffer.
+ * lsattr.c (lsattr_dir_proc): Ditto.
+ * mklost+fond.c (main): Calculate the actual needed size for the
+ path buffer instead of using MAXPATHLEN (which not all systems have).
+
+ * badblocks.c: Only include linux include files if we have them.
+ (flush_bufs): New function to flush a block device, optionally
+ syncing it first. This replaces other copies of this code.
+ (test_ro): Replace calls to ioctl with flush_bufs().
+ (test_rw): Ditto.
+
+ * Makefile.in: Rewritten to conform to GNU coding standards and
+ support separate compilation directories.
+
Sat Mar 11 10:59:58 1995 Theodore Y. Ts'o <tytso@localhost>
* mke2fs.c (main, zap_bootblock): Added new function
diff --git a/misc/Makefile b/misc/Makefile
deleted file mode 100644
index 4cb15b26..00000000
--- a/misc/Makefile
+++ /dev/null
@@ -1,90 +0,0 @@
-include ../MCONFIG
-
-CFLAGS= $(OPT) $(WFLAGS) -I../lib
-LDFLAGS= $(OPT)
-SPROGS= mke2fs badblocks tune2fs dumpe2fs fsck
-USPROGS= mklost+found
-SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 \
- fsck.8
-
-UPROGS= chattr lsattr
-UMANPAGES= chattr.1 lsattr.1
-
-TUNE2FS_OBJS= tune2fs.o
-MKLPF_OBJS= mklost+found.o
-MKE2FS_OBJS= mke2fs.o
-CHATTR_OBJS= chattr.o
-LSATTR_OBJS= lsattr.o
-DUMPE2FS_OBJS= dumpe2fs.o
-BADBLOCKS_OBJS= badblocks.o
-FSCK_OBJS= fsck.o
-
-LIBS= -L../lib -lext2fs -le2p -lcom_err
-DEPLIBS= ../lib/libext2fs.a ../lib/libe2p.a ../lib/libcom_err.a
-
-all: $(SPROGS) $(UPROGS) $(USPROGS)
-
-tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS)
- $(CC) $(LDFLAGS) -o tune2fs $(TUNE2FS_OBJS) $(LIBS)
-
-mklost+found: $(MKLPF_OBJS)
- $(CC) $(LDFLAGS) -o mklost+found $(MKLPF_OBJS)
-
-mke2fs: $(MKE2FS_OBJS) $(DEPLIBS)
- $(CC) $(LDFLAGS) -o mke2fs $(MKE2FS_OBJS) $(LIBS)
-
-mke2fs.static: $(MKE2FS_OBJS) $(DEPLIBS)
- $(CC) $(LDFLAGS) -static -o mke2fs.static $(MKE2FS_OBJS) $(LIBS)
-
-chattr: $(CHATTR_OBJS) $(DEPLIBS)
- $(CC) $(LDFLAGS) -o chattr $(CHATTR_OBJS) $(LIBS)
-
-lsattr: $(LSATTR_OBJS) $(DEPLIBS)
- $(CC) $(LDFLAGS) -o lsattr $(LSATTR_OBJS) $(LIBS)
-
-dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS)
- $(CC) $(LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS)
-
-badblocks: $(BADBLOCKS_OBJS) $(DEPLIBS)
- $(CC) $(LDFLAGS) -o badblocks $(BADBLOCKS_OBJS) $(LIBS)
-
-install:: $(SPROGS) $(UPROGS)
- for i in $(SPROGS); do \
- $(INSTALLBIN) $$i $(SBINDIR)/$$i; \
- done
- for i in $(USPROGS); do \
- $(INSTALLBIN) $$i $(USRSBINDIR)/$$i; \
- done
- ln -sf mke2fs $(SBINDIR)/mkfs.ext2
- for i in $(UPROGS); do \
- $(INSTALLBIN) $$i $(USRBINDIR)/$$i; \
- done
-
-install:: $(SMANPAGES) $(UMANPAGES)
- for i in $(SMANPAGES); do \
- $(INSTALLMAN) $$i $(SMANDIR)/$$i; \
- done
- for i in $(UMANPAGES); do \
- $(INSTALLMAN) $$i $(UMANDIR)/$$i; \
- done
-
-install-tree:: $(SPROGS) $(UPROGS)
- for i in $(SPROGS) $(UPROGS); do \
- rm -f ../bin/$$i; \
- cp $$i ../bin; \
- strip ../bin/$$i; \
- chmod 555 ../bin/$$i; \
- done
- ln -sf mke2fs ../bin/mkfs.ext2
-
-clean:
- rm -f $(SPROGS) $(USPROGS) $(UPROGS) mke2fs.static \
- \#* *.s *.o *.a *~ core
-
-really-clean: clean
- rm -f .depend
-
-dep depend .depend:
- $(CPP) $(CFLAGS) -M *.c >.depend
-
-include .depend
diff --git a/misc/Makefile.in b/misc/Makefile.in
new file mode 100644
index 00000000..ee031566
--- /dev/null
+++ b/misc/Makefile.in
@@ -0,0 +1,148 @@
+#
+# Standard e2fsprogs prologue....
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ..
+INSTALL = @INSTALL@
+
+@MCONFIG@
+
+SPROGS= mke2fs badblocks tune2fs dumpe2fs fsck
+USPROGS= mklost+found
+SMANPAGES= tune2fs.8 mklost+found.8 mke2fs.8 dumpe2fs.8 badblocks.8 fsck.8
+
+UPROGS= chattr lsattr
+UMANPAGES= chattr.1 lsattr.1
+
+TUNE2FS_OBJS= tune2fs.o
+MKLPF_OBJS= mklost+found.o
+MKE2FS_OBJS= mke2fs.o
+CHATTR_OBJS= chattr.o
+LSATTR_OBJS= lsattr.o
+DUMPE2FS_OBJS= dumpe2fs.o
+BADBLOCKS_OBJS= badblocks.o
+FSCK_OBJS= fsck.o
+
+SRCS= $(srcdir)/tune2fs.c $(srcdir)/mklost+found.c $(srcdir)/mke2fs.c \
+ $(srcdir)/chattr.c $(srcdir)/lsattr.c $(srcdir)/dumpe2fs.c \
+ $(srcdir)/badblocks.c $(srcdir)/fsck.c
+
+LIBS= -L../lib -lext2fs -le2p -lcom_err
+DEPLIBS= ../lib/libext2fs.a ../lib/libe2p.a ../lib/libcom_err.a
+
+.c.o:
+ $(CC) -c $(CFLAGS) $< -o $@
+
+all:: $(SPROGS) $(UPROGS) $(USPROGS)
+
+tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -o tune2fs $(TUNE2FS_OBJS) $(LIBS)
+
+mklost+found: $(MKLPF_OBJS)
+ $(CC) $(LDFLAGS) -o mklost+found $(MKLPF_OBJS)
+
+mke2fs: $(MKE2FS_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -o mke2fs $(MKE2FS_OBJS) $(LIBS)
+
+mke2fs.static: $(MKE2FS_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -static -o mke2fs.static $(MKE2FS_OBJS) $(LIBS)
+
+chattr: $(CHATTR_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -o chattr $(CHATTR_OBJS) $(LIBS)
+
+lsattr: $(LSATTR_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -o lsattr $(LSATTR_OBJS) $(LIBS)
+
+dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS)
+
+fsck: $(FSCK_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBS)
+
+badblocks: $(BADBLOCKS_OBJS) $(DEPLIBS)
+ $(CC) $(LDFLAGS) -o badblocks $(BADBLOCKS_OBJS) $(LIBS)
+
+installdirs:
+ $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \
+ $(DESTDIR)$(ubindir) $(DESTDIR)$(man1dir) \
+ $(DESTDIR)$(cat1dir) $(DESTDIR)$(man8dir) $(DESTDIR)$(cat8dir)
+
+install: all $(SMANPAGES) $(UMANPAGES) installdirs
+ for i in $(SPROGS); do \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(sbindir)/$$i; \
+ $(STRIP) $(DESTDIR)$(sbindir)/$$i; \
+ done
+ for i in $(USPROGS); do \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(usbindir)/$$i; \
+ $(STRIP) $(DESTDIR)$(usbindir)/$$i; \
+ done
+ $(LN) -f $(DESTDIR)$(sbindir)/mke2fs $(DESTDIR)$(sbindir)/mkfs.ext2
+ for i in $(UPROGS); do \
+ $(INSTALL_PROGRAM) $$i $(DESTDIR)$(ubindir)/$$i; \
+ $(STRIP) $(DESTDIR)$(ubindir)/$$i; \
+ done
+ for i in $(SMANPAGES); do \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(man8dir)/$$i; \
+ done
+ for i in $(UMANPAGES); do \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(man1dir)/$$i; \
+ done
+
+uninstall:
+ for i in $(SPROGS); do \
+ $(RM) -f $(sbindir)/$$i; \
+ done
+ for i in $(USPROGS); do \
+ $(RM) -f $(usbindir)/$$i; \
+ done
+ $(RM) -f $(sbindir)/mkfs.ext2
+ for i in $(UPROGS); do \
+ $(RM) -f $(ubindir)/$$i; \
+ done
+ for i in $(SMANPAGES); do \
+ $(RM) -f $(man8dir)/$$i; \
+ done
+ for i in $(UMANPAGES); do \
+ $(RM) -f $(man1dir)/$$i; \
+ done
+
+clean:
+ $(RM) -f $(SPROGS) $(USPROGS) $(UPROGS) mke2fs.static \
+ \#* *.s *.o *.a *~ core
+mostlyclean: clean
+distclean: clean
+ $(RM) -f .depend Makefile
+
+# +++ Dependency line eater +++
+#
+# Makefile dependencies follow. This must be the last section in
+# the Makefile.in file
+#
+tune2fs.o : $(srcdir)/tune2fs.c \
+ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(srcdir)/../version.h
+mklost+found.o : $(srcdir)/mklost+found.c \
+ $(srcdir)/../version.h
+mke2fs.o : $(srcdir)/mke2fs.c \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h $(srcdir)/../version.h
+chattr.o : $(srcdir)/chattr.c \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(srcdir)/../version.h
+lsattr.o : $(srcdir)/lsattr.c \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(srcdir)/../version.h
+dumpe2fs.o : $(srcdir)/dumpe2fs.c \
+ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
+ $(top_srcdir)/lib/ext2fs/io.h $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(srcdir)/../version.h
+badblocks.o : $(srcdir)/badblocks.c \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/ext2fs/io.h
+fsck.o : $(srcdir)/fsck.c \
+ $(srcdir)/../version.h \
+ $(srcdir)/fsck.h
+
diff --git a/misc/badblocks.8 b/misc/badblocks.8
index 79a95c7c..57e1db5a 100644
--- a/misc/badblocks.8
+++ b/misc/badblocks.8
@@ -1,5 +1,5 @@
.\" -*- nroff -*-
-.TH BADBLOCKS 8 "November 1994" "Version 0.5b"
+.TH BADBLOCKS 8 "August 1995" "Version 0.5c"
.SH NAME
badblocks \- search a device for bad blocks
.SH SYNOPSIS
diff --git a/misc/badblocks.c b/misc/badblocks.c
index b9bcaca8..dd9968b9 100644
--- a/misc/badblocks.c
+++ b/misc/badblocks.c
@@ -20,7 +20,9 @@
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_GETOPT_H
#include <getopt.h>
+#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -30,8 +32,10 @@
#include <sys/ioctl.h>
#include <sys/types.h>
+#if HAVE_LINUX_FS_H
#include <linux/fd.h>
#include <linux/fs.h>
+#endif
#include "et/com_err.h"
#include "ext2fs/io.h"
@@ -88,6 +92,26 @@ static void alarm_intr (int alnum)
fflush (stderr);
}
+static void flush_bufs (int dev, int sync)
+{
+ if (v_flag
+#if !defined (BLKFLSBUF) && !defined (FDFLUSH)
+ && sync
+#endif
+ )
+ fprintf (stderr, "Flushing buffers\n");
+
+ if (sync && fsync (dev) == -1)
+ com_err (program_name, errno, "during fsync");
+
+#ifdef BLKLSBUF
+ ioctl (dev, BLKFLSBUF, 0); /* In case this is a HD */
+#endif
+#ifdef FDFLUSH
+ ioctl (dev, FDFLUSH, 0); /* In case this is floppy */
+#endif
+}
+
static void test_ro (int dev, unsigned long blocks_count,
unsigned long block_size, FILE * out,
unsigned long from_count)
@@ -103,11 +127,7 @@ static void test_ro (int dev, unsigned long blocks_count,
com_err (program_name, ENOMEM, "while allocating buffers");
exit (1);
}
-
- if (v_flag)
- fprintf (stderr, "Flushing buffers\n");
- ioctl (dev, BLKFLSBUF, 0); /* In case this is a HD */
- ioctl (dev, FDFLUSH, 0); /* In case this is floppy */
+ flush_bufs (dev, 0);
if (v_flag) {
fprintf (stderr,
"Checking for bad blocks in read-only mode\n");
@@ -158,10 +178,8 @@ static void test_rw (int dev, unsigned long blocks_count,
exit (1);
}
- if (v_flag)
- fprintf (stderr, "Flushing buffers\n");
- ioctl (dev, BLKFLSBUF, 0); /* In case this is a HD */
- ioctl (dev, FDFLUSH, 0); /* In case this is floppy */
+ flush_bufs (dev, 0);
+
if (v_flag)
fprintf (stderr, "Checking for bad blocks in read-write mode\n");
for (i = 0; i < sizeof (pattern); i++)
@@ -190,12 +208,7 @@ static void test_rw (int dev, unsigned long blocks_count,
alarm (0);
if (s_flag | v_flag)
fprintf(stderr, "done \n");
- if (v_flag)
- fprintf (stderr, "Flushing buffers\n");
- if (fsync (dev) == -1)
- com_err (program_name, errno, "during fsync");
- ioctl (dev, BLKFLSBUF, 0); /* In case this is a HD */
- ioctl (dev, FDFLUSH, 0); /* In case this is floppy */
+ flush_bufs (dev, 1);
if (s_flag | v_flag)
fprintf (stderr, "Reading and comparing: ");
num_blocks = blocks_count;
@@ -221,10 +234,7 @@ static void test_rw (int dev, unsigned long blocks_count,
alarm (0);
if (s_flag | v_flag)
fprintf(stderr, "done \n");
- if (v_flag)
- fprintf (stderr, "Flushing buffers\n");
- ioctl (dev, BLKFLSBUF, 0); /* In case this is a HD */
- ioctl (dev, FDFLUSH, 0); /* In case this is floppy */
+ flush_bufs (dev, 0);
}
}
diff --git a/misc/chattr.1 b/misc/chattr.1
index 2a45667f..09a9bfb2 100644
--- a/misc/chattr.1
+++ b/misc/chattr.1
@@ -1,5 +1,5 @@
.\" -*- nroff -*-
-.TH CHATTR 1 "November 1994" "Version 0.5b"
+.TH CHATTR 1 "October 1995" "Version 0.5c"
.SH NAME
chattr \- change file attributes on a Linux second extended file system
.SH SYNOPSIS
diff --git a/misc/chattr.c b/misc/chattr.c
index 8df57e9f..a90bdf4d 100644
--- a/misc/chattr.c
+++ b/misc/chattr.c
@@ -16,12 +16,18 @@
* 94/02/27 - Integrated in Ted's distribution
*/
+#include <sys/types.h>
#include <dirent.h>
#include <fcntl.h>
+#ifdef HAVE_GETOPT_H
#include <getopt.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
#include <sys/param.h>
#include <sys/stat.h>
#include <linux/ext2_fs.h>
@@ -264,12 +270,17 @@ static void change_attributes (const char * name)
static int chattr_dir_proc (const char * dir_name, struct dirent * de, void * private)
{
- char path[MAXPATHLEN];
-
if (strcmp (de->d_name, ".") && strcmp (de->d_name, ".."))
{
+ char *path;
+
+ path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1);
+ if (!path)
+ fatal_error("Couldn't allocate path variable "
+ "in chattr_dir_proc", 1);
sprintf (path, "%s/%s", dir_name, de->d_name);
change_attributes (path);
+ free(path);
}
return 0;
}
diff --git a/misc/dumpe2fs.8 b/misc/dumpe2fs.8
index 8cb25cc6..f54928d4 100644
--- a/misc/dumpe2fs.8
+++ b/misc/dumpe2fs.8
@@ -1,5 +1,8 @@
-.TH DUMPE2FS 8 "November 1994" "Version 0.5b"
-
+.\" -*- nroff -*-
+.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH DUMPE2FS 8 "October 1995" "Version 0.5c"
.SH NAME
dumpe2fs \- dump filesystem information
.SH SYNOPSIS
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index d820613e..b7a50b3e 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -16,7 +16,9 @@
* 94/02/27 - Ported to use the ext2fs library
*/
+#ifdef HAVE_GETOPT_H
#include <getopt.h>
+#endif
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -78,8 +80,8 @@ static void list_desc (ext2_filsys fs)
for (i = 0; i < fs->group_desc_count; i++)
{
printf ("Group %lu:\n", i);
- printf (" Block bitmap at %lu, Inode bitmap at %lu, "
- "Inode table at %lu\n",
+ printf (" Block bitmap at %u, Inode bitmap at %u, "
+ "Inode table at %u\n",
fs->group_desc[i].bg_block_bitmap,
fs->group_desc[i].bg_inode_bitmap,
fs->group_desc[i].bg_inode_table);
@@ -118,9 +120,9 @@ static void list_bad_blocks(ext2_filsys fs)
exit(1);
}
if (badblocks_list_iterate(bb_iter, &blk))
- printf("Bad blocks: %ld", blk);
+ printf("Bad blocks: %d", blk);
while (badblocks_list_iterate(bb_iter, &blk))
- printf(", %ld", blk);
+ printf(", %d", blk);
badblocks_list_iterate_end(bb_iter);
printf("\n");
}
@@ -144,7 +146,7 @@ static void dump_bad_blocks(ext2_filsys fs)
exit(1);
}
while (badblocks_list_iterate(bb_iter, &blk))
- printf("%ld\n", blk);
+ printf("%d\n", blk);
badblocks_list_iterate_end(bb_iter);
}
diff --git a/misc/fsck.8 b/misc/fsck.8
index cfc88326..7b78a682 100644
--- a/misc/fsck.8
+++ b/misc/fsck.8
@@ -1,5 +1,8 @@
.\" -*- nroff -*-
-.TH FSCK 8 "November 1994" "Version 0.5b"
+.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH FSCK 8 "October 1995" "Version 0.5c"
.SH NAME
fsck \- check and repair a Linux file system
.SH SYNOPSIS
diff --git a/misc/fsck.c b/misc/fsck.c
index 40f715f1..ef210245 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -26,15 +26,28 @@
#include <sys/wait.h>
#include <sys/signal.h>
#include <sys/stat.h>
-#include <errno.h>
#include <limits.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_ERRNO_H
#include <errno.h>
+#endif
+#if HAVE_MNTENT_H
#include <mntent.h>
+#endif
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <malloc.h>
+#ifdef HAVE_GETOPT_H
#include <getopt.h>
+#endif
#include "../version.h"
#include "fsck.h"
@@ -114,9 +127,15 @@ char *progname;
char *fstype = NULL;
struct fs_info *filesys_info;
struct fsck_instance *instance_list;
-static char fsck_path[PATH_MAX + 32];
+const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc";
+char *fsck_path = 0;
static int ignore(struct fs_info *);
+#ifdef HAVE_STRDUP
+#ifdef _POSIX_SOURCE
+extern char *strdup(const char *s);
+#endif
+#else
static char *strdup(const char *s)
{
char *ret;
@@ -126,6 +145,7 @@ static char *strdup(const char *s)
strcpy(ret, s);
return ret;
}
+#endif
static void free_instance(struct fsck_instance *i)
{
@@ -142,9 +162,11 @@ static void free_instance(struct fsck_instance *i)
*/
static void load_fs_info(NOARGS)
{
+#if HAVE_MNTENT_H
FILE *mntfile;
struct mntent *mp;
struct fs_info *fs;
+ struct fs_info *fs_last = NULL;
int old_fstab = 1;
filesys_info = NULL;
@@ -164,8 +186,12 @@ static void load_fs_info(NOARGS)
fs->opts = strdup(mp->mnt_opts);
fs->freq = mp->mnt_freq;
fs->passno = mp->mnt_passno;
- fs->next = filesys_info;
- filesys_info = fs;
+ fs->next = NULL;
+ if (!filesys_info)
+ filesys_info = fs;
+ else
+ fs_last->next = fs;
+ fs_last = fs;
if (fs->passno)
old_fstab = 0;
}
@@ -184,6 +210,9 @@ static void load_fs_info(NOARGS)
fs->passno = 1;
}
}
+#else
+ filesys_info = NULL;
+#endif /* HAVE_MNTENT_H */
}
/* Lookup filesys in /etc/fstab and return the corresponding entry. */
@@ -366,21 +395,30 @@ static int wait_all(NOARGS)
/*
* Run the fsck program on a particular device
+ *
+ * If the type is specified using -t, and it isn't prefixed with "no"
+ * (as in "noext2") and only one filesystem type is specified, then
+ * use that type regardless of what is specified in /etc/fstab.
+ *
+ * If the type isn't specified by the user, then use either the type
+ * specified in /etc/fstab, or DEFAULT_FSTYPE.
*/
static void fsck_device(char *device)
{
- const char *type;
+ const char *type = 0;
struct fs_info *fsent;
int retval;
char prog[80];
+ if (fstype && strncmp(type, "no", 2) && !strchr(type, ','))
+ type = fstype;
+
if ((fsent = lookup(device))) {
device = fsent->device;
- type = fsent->type;
- } else if (fstype && strncmp(fstype, "no", 2) &&
- !strchr(fstype, ','))
- type = fstype;
- else
+ if (!type)
+ type = fsent->type;
+ }
+ if (!type)
type = DEFAULT_FSTYPE;
sprintf(prog, "fsck.%s", type);
@@ -699,9 +737,9 @@ static void PRS(int argc, char *argv[])
int main(int argc, char *argv[])
{
- char *oldpath;
- int status = 0;
int i;
+ int status = 0;
+ char *oldpath = getenv("PATH");
PRS(argc, argv);
@@ -710,10 +748,16 @@ int main(int argc, char *argv[])
E2FSPROGS_VERSION, E2FSPROGS_DATE);
/* Update our search path to include uncommon directories. */
- strcpy(fsck_path, "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc:");
- if ((oldpath = getenv("PATH")) != NULL)
- strcat(fsck_path, oldpath);
-
+ if (oldpath) {
+ fsck_path = malloc (strlen (fsck_prefix_path) + 1 +
+ strlen (oldpath) + 1);
+ strcpy (fsck_path, fsck_prefix_path);
+ strcat (fsck_path, ":");
+ strcat (fsck_path, oldpath);
+ } else {
+ fsck_path = strdup(oldpath);
+ }
+
/* If -A was specified ("check all"), do that! */
if (doall)
return check_all();
@@ -730,7 +774,7 @@ int main(int argc, char *argv[])
}
}
}
-
status |= wait_all();
+ free(fsck_path);
return status;
}
diff --git a/misc/lsattr.1 b/misc/lsattr.1
index ea61acd0..5b634312 100644
--- a/misc/lsattr.1
+++ b/misc/lsattr.1
@@ -1,5 +1,5 @@
.\" -*- nroff -*-
-.TH LSATTR 1 "November 1994" "Version 0.5b"
+.TH LSATTR 1 "October 1995" "Version 0.5c"
.SH NAME
lsattr \- list file attributes on a Linux second extended file system
.SH SYNOPSIS
@@ -12,7 +12,7 @@ files...
]
.SH DESCRIPTION
.B lsattr
-lists the files attributes on an second extended file system.
+lists the file attributes on a second extended file system.
.SH OPTIONS
.TP
.I -R
diff --git a/misc/lsattr.c b/misc/lsattr.c
index 6ce190c4..3fe4b9a0 100644
--- a/misc/lsattr.c
+++ b/misc/lsattr.c
@@ -16,12 +16,21 @@
* 94/02/27 - Integrated in Ted's distribution
*/
+#include <sys/types.h>
#include <dirent.h>
+#ifdef HAVE_ERRNO_H
#include <errno.h>
+#endif
#include <fcntl.h>
+#ifdef HAVE_GETOPT_H
#include <getopt.h>
+#else
+extern int optind;
+extern char *optarg;
+#endif
#include <stdio.h>
#include <unistd.h>
+#include <stdlib.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <linux/ext2_fs.h>
@@ -84,26 +93,28 @@ static void lsattr_args (const char * name)
static int lsattr_dir_proc (const char * dir_name, struct dirent * de, void * private)
{
- char path [MAXPATHLEN];
struct stat st;
+ char *path;
+
+ path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1);
sprintf (path, "%s/%s", dir_name, de->d_name);
if (lstat (path, &st) == -1)
perror (path);
- else
- {
- if (de->d_name[0] != '.' || all)
- {
+ else {
+ if (de->d_name[0] != '.' || all) {
list_attributes (path);
if (S_ISDIR(st.st_mode) && recursive &&
- strcmp (de->d_name, ".") && strcmp (de->d_name, ".."))
- {
+ strcmp(de->d_name, ".") &&
+ strcmp(de->d_name, "..")) {
printf ("\n%s:\n", path);
- iterate_on_dir (path, lsattr_dir_proc, (void *) NULL);
+ iterate_on_dir (path, lsattr_dir_proc,
+ (void *) NULL);
printf ("\n");
}
}
}
+ free(path);
return 0;
}
diff --git a/misc/mke2fs.8 b/misc/mke2fs.8
index c398986b..16976857 100644
--- a/misc/mke2fs.8
+++ b/misc/mke2fs.8
@@ -1,5 +1,8 @@
.\" -*- nroff -*-
-.TH MKE2FS 8 "November 1994" "Version 0.5b"
+.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH MKE2FS 8 "October 1995" "Version 0.5c"
.SH NAME
mke2fs \- create a Linux second extended file system
.SH SYNOPSIS
@@ -106,7 +109,7 @@ is no gaurantee that any data will be salvageable.
.SH AUTHOR
This version of
.B mke2fs
-has been written by Theodore T'so <tytso@mit.edu>.
+has been written by Theodore Ts'o <tytso@mit.edu>.
.SH BUGS
.B mke2fs
accepts the -f option but currently ignores it because the second
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 13f536ab..687deba6 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -11,20 +11,35 @@
* enforced (but it's not much fun on a character device :-).
*/
+#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <termios.h>
#include <time.h>
+#ifdef HAVE_GETOPT_H
#include <getopt.h>
+#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_MNTENT_H
#include <mntent.h>
+#endif
#include <malloc.h>
#include <sys/ioctl.h>
#include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h>
+#endif
#include <linux/ext2_fs.h>
#include "et/com_err.h"
@@ -71,72 +86,21 @@ static int log2(int arg)
return l;
}
-static long valid_offset (int fd, ext2_loff_t offset)
-{
- char ch;
-
- if (ext2_llseek (fd, offset, 0) < 0)
- return 0;
- if (read (fd, &ch, 1) < 1)
- return 0;
- return 1;
-}
-
-static int count_blocks (int fd)
-{
- ext2_loff_t high, low;
-
- low = 0;
- for (high = 1; valid_offset (fd, high); high *= 2)
- low = high;
- while (low < high - 1)
- {
- const ext2_loff_t mid = (low + high) / 2;
-
- if (valid_offset (fd, mid))
- low = mid;
- else
- high = mid;
- }
- valid_offset (fd, 0);
- return (low + 1) / 1024;
-}
-
-static int get_size(const char *file)
-{
- int fd;
- int size;
-
- fd = open(file, O_RDWR);
- if (fd < 0) {
- com_err("open", errno, "while trying to determine size of %s",
- file);
- exit(1);
- }
- if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
- close(fd);
- return size / (EXT2_BLOCK_SIZE(&param) / 512);
- }
-
- size = count_blocks(fd);
- close(fd);
- return size;
-}
-
static void check_mount(NOARGS)
{
- FILE * f;
- struct mntent * mnt;
+ errcode_t retval;
+ int mount_flags;
- if ((f = setmntent (MOUNTED, "r")) == NULL)
+ retval = ext2fs_check_if_mounted(device_name, &mount_flags);
+ if (retval) {
+ com_err("ext2fs_check_if_mount", retval,
+ "while determining whether %s is mounted.",
+ device_name);
return;
- while ((mnt = getmntent (f)) != NULL)
- if (strcmp (device_name, mnt->mnt_fsname) == 0)
- break;
- endmntent (f);
- if (!mnt)
+ }
+ if (!(mount_flags & EXT2_MF_MOUNTED))
return;
-
+
fprintf(stderr, "%s is mounted; will not make a filesystem here!\n",
device_name);
exit(1);
@@ -147,7 +111,7 @@ static void check_mount(NOARGS)
*/
static void invalid_block(ext2_filsys fs, blk_t blk)
{
- printf("Bad block %lu out of range; ignored.\n", blk);
+ printf("Bad block %u out of range; ignored.\n", blk);
return;
}
@@ -184,7 +148,7 @@ static void test_disk(ext2_filsys fs, badblocks_list *bb_list)
errcode_t retval;
char buf[1024];
- sprintf(buf, "badblocks %s%s %ld", quiet ? "" : "-s ",
+ sprintf(buf, "badblocks %s%s %d", quiet ? "" : "-s ",
fs->device_name,
fs->super->s_blocks_count);
if (verbose)
@@ -227,7 +191,7 @@ static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list)
if (badblocks_list_test(bb_list, i)) {
fprintf(stderr, "Block %d in primary superblock/group "
"descriptor area bad.\n", i);
- fprintf(stderr, "Blocks %ld through %d must be good "
+ fprintf(stderr, "Blocks %d through %d must be good "
"in order to build a filesystem.\n",
fs->super->s_first_data_block, must_be_good);
fprintf(stderr, "Aborting....\n");
@@ -250,7 +214,7 @@ static void handle_bad_blocks(ext2_filsys fs, badblocks_list bb_list)
j)) {
if (!group_bad)
fprintf(stderr,
-"Warning: the backup superblock/group descriptors at block %ld contain\n"
+"Warning: the backup superblock/group descriptors at block %d contain\n"
" bad blocks.\n\n",
group_block);
group_bad++;
@@ -304,7 +268,7 @@ static void new_table_block(ext2_filsys fs, blk_t first_block,
retval = io_channel_write_blk(fs->io, blk, count, buf);
if (retval)
printf("Warning: could not write %d blocks "
- "starting at %ld for %s: %s\n",
+ "starting at %d for %s: %s\n",
count, blk, name,
error_message(retval));
}
@@ -457,24 +421,24 @@ static void show_stats(ext2_filsys fs)
int i, col_left;
if (param.s_blocks_count != s->s_blocks_count)
- printf("warning: %ld blocks unused.\n\n",
+ printf("warning: %d blocks unused.\n\n",
param.s_blocks_count - s->s_blocks_count);
- printf("%lu inodes, %lu blocks\n", s->s_inodes_count,
+ printf("%u inodes, %u blocks\n", s->s_inodes_count,
s->s_blocks_count);
- printf("%lu blocks (%2.2f%%) reserved for the super user\n",
+ printf("%u blocks (%2.2f%%) reserved for the super user\n",
s->s_r_blocks_count,
100.0 * s->s_r_blocks_count / s->s_blocks_count);
- printf("First data block=%lu\n", s->s_first_data_block);
- printf("Block size=%u (log=%lu)\n", fs->blocksize,
+ printf("First data block=%u\n", s->s_first_data_block);
+ printf("Block size=%u (log=%u)\n", fs->blocksize,
s->s_log_block_size);
- printf("Fragment size=%u (log=%lu)\n", fs->fragsize,
+ printf("Fragment size=%u (log=%u)\n", fs->fragsize,
s->s_log_frag_size);
printf("%lu block group%s\n", fs->group_desc_count,
(fs->group_desc_count > 1) ? "s" : "");
- printf("%lu blocks per group, %lu fragments per group\n",
+ printf("%u blocks per group, %u fragments per group\n",
s->s_blocks_per_group, s->s_frags_per_group);
- printf("%lu inodes per group\n", s->s_inodes_per_group);
+ printf("%u inodes per group\n", s->s_inodes_per_group);
if (fs->group_desc_count == 1) {
printf("\n");
@@ -490,28 +454,36 @@ static void show_stats(ext2_filsys fs)
printf("\n\t");
col_left = 8;
}
- printf("%lu", group_block);
+ printf("%u", group_block);
if (i != fs->group_desc_count - 1)
printf(", ");
}
printf("\n\n");
}
+#define PATH_SET "PATH=/sbin"
+
static void PRS(int argc, char *argv[])
{
char c;
int size;
char * tmp;
- char *oldpath;
- static char newpath[PATH_MAX];
int inode_ratio = 4096;
int reserved_ratio = 5;
+ errcode_t retval;
+ char *oldpath = getenv("PATH");
/* Update our PATH to include /sbin */
- strcpy(newpath, "PATH=/sbin:");
- if ((oldpath = getenv("PATH")) != NULL)
- strcat(newpath, oldpath);
- putenv(newpath);
+ if (oldpath) {
+ char *newpath;
+
+ newpath = malloc(sizeof (PATH_SET) + 1 + strlen (oldpath));
+ strcpy (newpath, PATH_SET);
+ strcat (newpath, ":");
+ strcat (newpath, oldpath);
+ putenv (newpath);
+ } else
+ putenv (PATH_SET);
setbuf(stdout, NULL);
setbuf(stderr, NULL);
@@ -623,10 +595,21 @@ static void PRS(int argc, char *argv[])
}
if (optind < argc)
usage();
+
+ check_mount();
+
param.s_log_frag_size = param.s_log_block_size;
- if (!param.s_blocks_count)
- param.s_blocks_count = get_size(device_name);
+ if (!param.s_blocks_count) {
+ retval = ext2fs_get_device_size(device_name,
+ EXT2_BLOCK_SIZE(&param),
+ &param.s_blocks_count);
+ if (retval) {
+ com_err(program_name, 0,
+ "while trying to determine filesystem size");
+ exit(1);
+ }
+ }
/*
* Calculate number of inodes based on the inode ratio
@@ -649,8 +632,6 @@ int main (int argc, char *argv[])
PRS(argc, argv);
- check_mount();
-
/*
* Initialize the superblock....
*/
diff --git a/misc/mklost+found.8 b/misc/mklost+found.8
index e757ff80..a7fabd11 100644
--- a/misc/mklost+found.8
+++ b/misc/mklost+found.8
@@ -1,5 +1,8 @@
.\" -*- nroff -*-
-.TH MKLOST+FOUND 8 "November 1994" "Version 0.5b"
+.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH MKLOST+FOUND 8 "October 1995" "Version 0.5c"
.SH NAME
mklost+found \- create a lost+found directory on a mounted Linux
second extended file system
diff --git a/misc/mklost+found.c b/misc/mklost+found.c
index 299e47c9..2a960c45 100644
--- a/misc/mklost+found.c
+++ b/misc/mklost+found.c
@@ -30,7 +30,7 @@
void main (int argc, char ** argv)
{
char name [EXT2_NAME_LEN];
- char path [MAXPATHLEN];
+ char path [sizeof (LPF) + 1 + 256];
struct stat st;
int i, j;
int d;
diff --git a/misc/tune2fs.8 b/misc/tune2fs.8
index a3cbf35b..a4cc0752 100644
--- a/misc/tune2fs.8
+++ b/misc/tune2fs.8
@@ -2,7 +2,7 @@
.\" Initial revision
.\"
.\"
-.TH TUNE2FS 8 "November 1994" "Version 0.5b"
+.TH TUNE2FS 8 "October 1995" "Version 0.5c"
.SH NAME
tune2fs \- adjust tunable filesystem parameters on second extended filesystems
@@ -98,7 +98,7 @@ has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer
of the ext2 fs.
.br
.B tune2fs
-uses the ext2fs library written by Theodore T'so <tytso@mit.edu>.
+uses the ext2fs library written by Theodore Ts'o <tytso@mit.edu>.
.br
This manual page was written by Christian Kuhtz <chk@data-hh.Hanse.DE>.
.br
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index cd2d622a..1576ce44 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -24,7 +24,9 @@
#include <fcntl.h>
#include <grp.h>
+#ifdef HAVE_GETOPT_H
#include <getopt.h>
+#endif
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -120,8 +122,10 @@ void main (int argc, char ** argv)
gr = getgrnam (optarg);
if (gr == NULL)
tmp = optarg;
- else
+ else {
resgid = gr->gr_gid;
+ *tmp =0;
+ }
}
if (*tmp)
{
@@ -194,8 +198,10 @@ void main (int argc, char ** argv)
pw = getpwnam (optarg);
if (pw == NULL)
tmp = optarg;
- else
+ else {
resuid = pw->pw_uid;
+ *tmp = 0;
+ }
}
if (*tmp)
{
diff --git a/tests/ChangeLog b/tests/ChangeLog
new file mode 100644
index 00000000..f50ef6c3
--- /dev/null
+++ b/tests/ChangeLog
@@ -0,0 +1,16 @@
+Mon Sep 4 23:06:06 1995 Remy Card <card@bbj>
+
+ * Makefile.in (clean, distclean): Use the -f option when removing
+ files.
+
+Fri Aug 11 10:10:30 1995 Theodore Y. Ts'o <tytso@lurch.mit.edu>
+
+ * test_script: Count up the number of passed and failed tests by
+ tallying the *.ok and *.failed files.
+
+ * run_e2fsck: Create foo.ok and foo.failed files when tests
+ succeed or fail, respectively.
+
+ * test_config (TZ): Set the timezone to be GMT, so that test
+ results are consistent.
+
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 00000000..4c776663
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,23 @@
+#
+# Makefile for the tests directory
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ..
+INSTALL = @INSTALL@
+
+all:: @DO_TEST_SUITE@
+
+check::
+ @echo "Running e2fsprogs test suite..."
+ @echo " "
+ @$(srcdir)/test_script $(srcdir)
+
+clean::
+ $(RM) -f *.log *.new *.failed *.ok test.img
+
+distclean:: clean
+ $(RM) -f Makefile
+
diff --git a/tests/README b/tests/README
new file mode 100644
index 00000000..73e26817
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,67 @@
+These images contain various forms of corrupted filesystem which
+e2fsck will correct. They are used as a regression test for e2fsck.
+
+The test_script program will automatically run e2fsck against the
+filesystem images. It will run them two times, and display the exit
+status for each run. The meaning of the exit status codes are as
+follows:
+
+ 0 No filesystem errors were detected
+ 1 Filesystem errors detected, but corrected
+ 2 System should be rebooted
+ 4 Filesystem errors left uncorrected
+ 8 Operational error (generally means internal error,
+ or filesystem error that the e2fsck was not
+ prepared to deal with)
+ 16 Usage or syntax error
+
+During the regression test, the first exit code should be 1, and the
+second exit code should be 0. In other words, all (with one
+exception) of the test filesystems in this directory have some sort of
+filesystem corruption, which e2fsck should fix on the first pass.
+After the first pass, e2fsck should leave a fully consistent
+filesystem with no detectable errors found in the second pass. The
+exception is the okgroup.img filesystem, which contains no errors, and
+so both exit codes should be 0.
+
+NOTE: It appears that at least some versions of the original e2fsck do
+not exit with an exit status code of 1 after correcting filesystem
+errors. So if you modify the test_script to try running these
+filesystems against the original e2fsck, you will have to inspect the
+test_script.log file manually.
+
+--------------------------------------------------------------
+Here's a one-line descriptons of the various test images in this
+directory:
+
+baddir.img Filesystem with a corrupted directory
+badbblocks.img Filesystem with illegal blocks in the bad block inode.
+badinode.img Filesystem with various different corrupted inode
+ entries.
+badlkcnt.img Filesystem with deleted files with non-zero link count
+badroot.img Filesystem with a file for a root directory
+badtable.img Filesystem with blocks shared between the bitmaps and
+ inode table blocks and the bad block inode
+bbfile.img Filesystem with files containing bad blocks
+bitmaps.img Filesystem with corrupted inode and block bitmaps
+dirlink.img Filesystem with a hard link to a directory
+dup.img Filesystem with blocks claimed by two different files
+dup2.img Filesystem with blocks claimed by three different files
+dupfsblks.img Filesystem with blocks claimed by a file and
+ inode/block bitmaps and inode tables
+dupsuper.img Filesystem with blocks claimed by a file and
+ the superblock / group descriptors
+end-bitmap.img Filesystem with corruption at the end of the block
+ bitmap
+expand.img Tests e2fsck's ability to expand lost+found if
+ necessary
+lpf.img Filesystem with disconnected files and no /lost+found
+ directory
+mke2fs2b.img Filesystem with corruption similar to that
+ created by mke2fs version 0.2b
+noroot.img Filesystem with a deleted root directory
+okgroup.img Filesystem that's exactly 8193 blocks long
+ (otherwise OK)
+overfsblks.img Filesystem with overlapping inode and block bitmaps
+
+
diff --git a/tests/defaults/f_script b/tests/defaults/f_script
new file mode 100644
index 00000000..7a3b34f8
--- /dev/null
+++ b/tests/defaults/f_script
@@ -0,0 +1 @@
+. $cmd_dir/run_e2fsck
diff --git a/tests/f_badbblocks/expect.1 b/tests/f_badbblocks/expect.1
new file mode 100644
index 00000000..d819f652
--- /dev/null
+++ b/tests/f_badbblocks/expect.1
@@ -0,0 +1,20 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in bad block inode? yes
+
+Illegal block 101 in bad block inode. CLEARED
+Illegal block 103 in bad block inode. CLEARED
+Illegal block 234523 in bad block inode. CLEARED
+Illegal block 200 in bad block inode. CLEARED
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +50. FIXED
+Free blocks count wrong for group 0 (78, counted=77). FIXED
+Free blocks count wrong (78, counted=77). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 23/100 blocks
+Exit status is 1
diff --git a/tests/f_badbblocks/expect.2 b/tests/f_badbblocks/expect.2
new file mode 100644
index 00000000..f18e3083
--- /dev/null
+++ b/tests/f_badbblocks/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 23/100 blocks
+Exit status is 0
diff --git a/tests/f_badbblocks/image.gz b/tests/f_badbblocks/image.gz
new file mode 100644
index 00000000..fe39b7fe
--- /dev/null
+++ b/tests/f_badbblocks/image.gz
Binary files differ
diff --git a/tests/f_badbblocks/name b/tests/f_badbblocks/name
new file mode 100644
index 00000000..ab20f389
--- /dev/null
+++ b/tests/f_badbblocks/name
@@ -0,0 +1 @@
+illegal blocks in bad block inode
diff --git a/tests/f_baddir/expect.1 b/tests/f_baddir/expect.1
new file mode 100644
index 00000000..8ac16b88
--- /dev/null
+++ b/tests/f_baddir/expect.1
@@ -0,0 +1,39 @@
+Pass 1: Checking inodes, blocks, and sizes
+Directory 12, incorrect size, 182 (counted = 1024). Set size to counted? yes
+
+Inode 13 is a zero length directory. Clear? yes
+
+Pass 2: Checking directory structure
+Entry 'zero' in / (2) has deleted/unused inode 13.
+Clear? yes
+
+Directory inode 12, block 0, offset 0: directory corrupted
+Salvage? yes
+
+Missing '.' in directory inode 12.
+Fix? yes
+
+Missing '..' in directory inode 12.
+Fix? yes
+
+Pass 3: Checking directory connectivity
+'..' in /block.h (12) is . (0), should be / (2).
+Fix? yes
+
+Pass 4: Checking reference counts
+Inode 12 has ref count 1, expecting 2.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -22. FIXED
+Free blocks count wrong (76, counted=77). FIXED
+Inode bitmap differences: -13. FIXED
+Free inodes count wrong for group #0 (19, counted=20). FIXED
+Directories count wrong for group #0 (4, counted=3). FIXED
+Free inodes count wrong (19, counted=20). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 1
diff --git a/tests/f_baddir/expect.2 b/tests/f_baddir/expect.2
new file mode 100644
index 00000000..c21acaf8
--- /dev/null
+++ b/tests/f_baddir/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 0
diff --git a/tests/f_baddir/image.gz b/tests/f_baddir/image.gz
new file mode 100644
index 00000000..7f6a7827
--- /dev/null
+++ b/tests/f_baddir/image.gz
Binary files differ
diff --git a/tests/f_baddir/name b/tests/f_baddir/name
new file mode 100644
index 00000000..ee1947a5
--- /dev/null
+++ b/tests/f_baddir/name
@@ -0,0 +1 @@
+corrupted directory
diff --git a/tests/f_baddotdir/expect.1 b/tests/f_baddotdir/expect.1
new file mode 100644
index 00000000..657ccb46
--- /dev/null
+++ b/tests/f_baddotdir/expect.1
@@ -0,0 +1,48 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Missing '.' in directory inode 12.
+Fix? yes
+
+Missing '..' in directory inode 12.
+Fix? yes
+
+First entry in directory inode 13 contains 'X' (inode=11)
+instead of '.'.
+Change to be '.'? yes
+
+Missing '..' in directory inode 14.
+Fix? yes
+
+Second entry in directory inode 15 contains 'XX' (inode=11)
+instead of '..'.
+Change to be '..'? yes
+
+Missing '.' in directory inode 16.
+Fix? yes
+
+Missing '..' in directory inode 16.
+Fix? yes
+
+Pass 3: Checking directory connectivity
+'..' in /a (12) is . (0), should be / (2).
+Fix? yes
+
+'..' in /c (14) is . (0), should be / (2).
+Fix? yes
+
+'..' in /d (15) is . (0), should be / (2).
+Fix? yes
+
+'..' in /e (16) is . (0), should be / (2).
+Fix? yes
+
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (72, counted=73). FIXED
+Free blocks count wrong (72, counted=73). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 16/32 files, 27/100 blocks
+Exit status is 1
diff --git a/tests/f_baddotdir/expect.2 b/tests/f_baddotdir/expect.2
new file mode 100644
index 00000000..862f94f2
--- /dev/null
+++ b/tests/f_baddotdir/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/32 files, 27/100 blocks
+Exit status is 0
diff --git a/tests/f_baddotdir/image.gz b/tests/f_baddotdir/image.gz
new file mode 100644
index 00000000..a52bfb1f
--- /dev/null
+++ b/tests/f_baddotdir/image.gz
Binary files differ
diff --git a/tests/f_baddotdir/name b/tests/f_baddotdir/name
new file mode 100644
index 00000000..c13ba757
--- /dev/null
+++ b/tests/f_baddotdir/name
@@ -0,0 +1 @@
+bad '.' and '..' entries
diff --git a/tests/f_badinode/expect.1 b/tests/f_badinode/expect.1
new file mode 100644
index 00000000..7ed7b542
--- /dev/null
+++ b/tests/f_badinode/expect.1
@@ -0,0 +1,25 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Inode 12 (/motd) has a bad mode (0110444).
+Clear? yes
+
+i_fsize for inode 13 (/timings) is 4, should be zero.
+Clear i_fsize? yes
+
+i_file_acl for inode 13 (/timings) is 39, should be zero.
+Clear i_file_acl? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -25. FIXED
+Free blocks count wrong for group 0 (76, counted=77). FIXED
+Free blocks count wrong (76, counted=77). FIXED
+Free inodes count wrong for group #0 (19, counted=20). FIXED
+Free inodes count wrong (19, counted=20). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 1
diff --git a/tests/f_badinode/expect.2 b/tests/f_badinode/expect.2
new file mode 100644
index 00000000..c21acaf8
--- /dev/null
+++ b/tests/f_badinode/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 0
diff --git a/tests/f_badinode/image.gz b/tests/f_badinode/image.gz
new file mode 100644
index 00000000..7b3ccd2a
--- /dev/null
+++ b/tests/f_badinode/image.gz
Binary files differ
diff --git a/tests/f_badinode/name b/tests/f_badinode/name
new file mode 100644
index 00000000..38ee2d9b
--- /dev/null
+++ b/tests/f_badinode/name
@@ -0,0 +1 @@
+corrupted inode entries
diff --git a/tests/f_badlkcnt/expect.1 b/tests/f_badlkcnt/expect.1
new file mode 100644
index 00000000..d3ad6a71
--- /dev/null
+++ b/tests/f_badlkcnt/expect.1
@@ -0,0 +1,17 @@
+Pass 1: Checking inodes, blocks, and sizes
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.
+Fix inode(s)? yes
+
+Inode 13 is deleted w/ non-zero link_count. CLEARED
+Inode 15 is deleted w/ non-zero link_count. CLEARED
+Inode 16 is deleted w/ non-zero link_count. CLEARED
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 29/32 files, 32/100 blocks
+Exit status is 1
diff --git a/tests/f_badlkcnt/expect.2 b/tests/f_badlkcnt/expect.2
new file mode 100644
index 00000000..6b2ea70e
--- /dev/null
+++ b/tests/f_badlkcnt/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 29/32 files, 32/100 blocks
+Exit status is 0
diff --git a/tests/f_badlkcnt/image.gz b/tests/f_badlkcnt/image.gz
new file mode 100644
index 00000000..3ba07cc2
--- /dev/null
+++ b/tests/f_badlkcnt/image.gz
Binary files differ
diff --git a/tests/f_badlkcnt/name b/tests/f_badlkcnt/name
new file mode 100644
index 00000000..d57851d2
--- /dev/null
+++ b/tests/f_badlkcnt/name
@@ -0,0 +1 @@
+deleted files with non-zero link count
diff --git a/tests/f_badprimary/expect.1 b/tests/f_badprimary/expect.1
new file mode 100644
index 00000000..54106736
--- /dev/null
+++ b/tests/f_badprimary/expect.1
@@ -0,0 +1,25 @@
+Pass 1: Checking inodes, blocks, and sizes
+The primary superblock (1) is on the bad block list.
+
+If the block is really bad, the filesystem can not be fixed.
+You can clear the this block from the bad block list
+and hope that block is really OK, but there are no guarantees.
+
+Clear (and hope for the best)? yes
+
+Block 2 in the primary group descriptors is on the bad block list
+
+If the block is really bad, the filesystem can not be fixed.
+You can clear the this block from the bad block list
+and hope that block is really OK, but there are no guarantees.
+
+Clear (and hope for the best)? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_badprimary/expect.2 b/tests/f_badprimary/expect.2
new file mode 100644
index 00000000..b8b19f83
--- /dev/null
+++ b/tests/f_badprimary/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_badprimary/image.gz b/tests/f_badprimary/image.gz
new file mode 100644
index 00000000..7aeb6110
--- /dev/null
+++ b/tests/f_badprimary/image.gz
Binary files differ
diff --git a/tests/f_badprimary/name b/tests/f_badprimary/name
new file mode 100644
index 00000000..dacce312
--- /dev/null
+++ b/tests/f_badprimary/name
@@ -0,0 +1 @@
+bad blocks in the primary superblock and group descriptors
diff --git a/tests/f_badroot/expect.1 b/tests/f_badroot/expect.1
new file mode 100644
index 00000000..e04d9ccb
--- /dev/null
+++ b/tests/f_badroot/expect.1
@@ -0,0 +1,37 @@
+Pass 1: Checking inodes, blocks, and sizes
+Root inode is not a directory. Clear? yes
+
+Pass 2: Checking directory structure
+Entry '..' in ??? (11) has deleted/unused inode 2.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Root inode not allocated. Rellocate? yes
+
+Unconnected directory inode 11 (...)
+Connect to /lost+found? yes
+
+/lost+found not found. Create? yes
+
+Pass 4: Checking reference counts
+Inode 11 has ref count 3, expecting 2.
+Set i_nlinks to count? yes
+
+Unattached inode 12
+Connect to /lost+found? yes
+
+Inode 12 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (77, counted=76). FIXED
+Free blocks count wrong (77, counted=76). FIXED
+Free inodes count wrong for group #0 (20, counted=19). FIXED
+Directories count wrong for group #0 (2, counted=3). FIXED
+Free inodes count wrong (20, counted=19). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 1
diff --git a/tests/f_badroot/expect.2 b/tests/f_badroot/expect.2
new file mode 100644
index 00000000..7871e7d2
--- /dev/null
+++ b/tests/f_badroot/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 0
diff --git a/tests/f_badroot/image.gz b/tests/f_badroot/image.gz
new file mode 100644
index 00000000..72980a35
--- /dev/null
+++ b/tests/f_badroot/image.gz
Binary files differ
diff --git a/tests/f_badroot/name b/tests/f_badroot/name
new file mode 100644
index 00000000..399e4f29
--- /dev/null
+++ b/tests/f_badroot/name
@@ -0,0 +1 @@
+file in root directory inode
diff --git a/tests/f_badtable/expect.1 b/tests/f_badtable/expect.1
new file mode 100644
index 00000000..f1c00e15
--- /dev/null
+++ b/tests/f_badtable/expect.1
@@ -0,0 +1,29 @@
+Pass 1: Checking inodes, blocks, and sizes
+Group 0's block bitmap (3) is bad. Relocate? yes
+
+Group 0's inode bitmap (4) is bad. Relocate? yes
+
+WARNING: Severe data loss possible!!!!
+Bad block 6 in group 0's inode table. Relocate? yes
+
+WARNING: Severe data loss possible!!!!
+Bad block 8 in group 0's inode table. Relocate? yes
+
+Relocating group 0's block bitmap from 3 to 22...
+Relocating group 0's inode bitmap from 4 to 23...
+Relocating group 0's inode table from 5 to 24...
+Restarting e2fsck from the beginning...
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -5 -7 +22 +23 +24 +25 +26 +27. FIXED
+Free blocks count wrong for group 0 (78, counted=74). FIXED
+Free blocks count wrong (78, counted=74). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 26/100 blocks
+Exit status is 1
diff --git a/tests/f_badtable/expect.2 b/tests/f_badtable/expect.2
new file mode 100644
index 00000000..d6a69dd5
--- /dev/null
+++ b/tests/f_badtable/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 26/100 blocks
+Exit status is 0
diff --git a/tests/f_badtable/image.gz b/tests/f_badtable/image.gz
new file mode 100644
index 00000000..48dbac15
--- /dev/null
+++ b/tests/f_badtable/image.gz
Binary files differ
diff --git a/tests/f_badtable/name b/tests/f_badtable/name
new file mode 100644
index 00000000..e4a8baea
--- /dev/null
+++ b/tests/f_badtable/name
@@ -0,0 +1 @@
+bad blocks in bitmaps and inode table
diff --git a/tests/f_bbfile/expect.1 b/tests/f_bbfile/expect.1
new file mode 100644
index 00000000..7b6088bc
--- /dev/null
+++ b/tests/f_bbfile/expect.1
@@ -0,0 +1,44 @@
+Pass 1: Checking inodes, blocks, and sizes
+Group 0's inode bitmap (4) is bad. Relocate? yes
+
+Relocating group 0's inode bitmap from 4 to 43...
+Duplicate blocks found... invoking duplicate block passes.
+Pass 1B: Rescan for duplicate/bad blocks
+Duplicate/bad block(s) in inode 2: 21
+Duplicate/bad block(s) in inode 11: 9 10 11 12 13 14 15 16 17 18 19 20
+Duplicate/bad block(s) in inode 12: 25 26
+Pass 1C: Scan directories for inodes with dup blocks.
+Pass 1D: Reconciling duplicate blocks
+(There are 3 inodes containing duplicate/bad blocks.)
+
+File /termcap (inode #12, mod time Sun Jan 2 08:29:13 1994)
+ has 2 duplicate blocks, shared with 1 file:
+ <The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994)
+Clone duplicate/bad blocks? yes
+
+
+File /lost+found (inode #11, mod time Sun Jan 2 08:28:40 1994)
+ has 12 duplicate blocks, shared with 1 file:
+ <The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994)
+Clone duplicate/bad blocks? yes
+
+
+File / (inode #2, mod time Sun Jan 2 08:29:13 1994)
+ has 1 duplicate blocks, shared with 1 file:
+ <The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994)
+Clone duplicate/bad blocks? yes
+
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +43. FIXED
+Free blocks count wrong for group 0 (57, counted=41). FIXED
+Free blocks count wrong (57, counted=41). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 59/100 blocks
+Exit status is 1
diff --git a/tests/f_bbfile/expect.2 b/tests/f_bbfile/expect.2
new file mode 100644
index 00000000..3ddc85d3
--- /dev/null
+++ b/tests/f_bbfile/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 59/100 blocks
+Exit status is 0
diff --git a/tests/f_bbfile/image.gz b/tests/f_bbfile/image.gz
new file mode 100644
index 00000000..3b013816
--- /dev/null
+++ b/tests/f_bbfile/image.gz
Binary files differ
diff --git a/tests/f_bbfile/name b/tests/f_bbfile/name
new file mode 100644
index 00000000..8843fbb0
--- /dev/null
+++ b/tests/f_bbfile/name
@@ -0,0 +1 @@
+bad blocks in files
diff --git a/tests/f_bitmaps/expect.1 b/tests/f_bitmaps/expect.1
new file mode 100644
index 00000000..0e0b74ba
--- /dev/null
+++ b/tests/f_bitmaps/expect.1
@@ -0,0 +1,13 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +12 -20 +41 -50. FIXED
+Inode bitmap differences: +11 -15. FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_bitmaps/expect.2 b/tests/f_bitmaps/expect.2
new file mode 100644
index 00000000..b8b19f83
--- /dev/null
+++ b/tests/f_bitmaps/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_bitmaps/image.gz b/tests/f_bitmaps/image.gz
new file mode 100644
index 00000000..1c533ebc
--- /dev/null
+++ b/tests/f_bitmaps/image.gz
Binary files differ
diff --git a/tests/f_bitmaps/name b/tests/f_bitmaps/name
new file mode 100644
index 00000000..a309bfaf
--- /dev/null
+++ b/tests/f_bitmaps/name
@@ -0,0 +1 @@
+corrupted inode and block bitmaps
diff --git a/tests/f_dirlink/expect.1 b/tests/f_dirlink/expect.1
new file mode 100644
index 00000000..c89f34bb
--- /dev/null
+++ b/tests/f_dirlink/expect.1
@@ -0,0 +1,12 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Entry 'quux' in /foo (12) is a link to directory /bar (13).
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 1
diff --git a/tests/f_dirlink/expect.2 b/tests/f_dirlink/expect.2
new file mode 100644
index 00000000..7871e7d2
--- /dev/null
+++ b/tests/f_dirlink/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 0
diff --git a/tests/f_dirlink/image.gz b/tests/f_dirlink/image.gz
new file mode 100644
index 00000000..2e8def47
--- /dev/null
+++ b/tests/f_dirlink/image.gz
Binary files differ
diff --git a/tests/f_dirlink/name b/tests/f_dirlink/name
new file mode 100644
index 00000000..30dbdce0
--- /dev/null
+++ b/tests/f_dirlink/name
@@ -0,0 +1 @@
+directory hard links
diff --git a/tests/f_dup/expect.1 b/tests/f_dup/expect.1
new file mode 100644
index 00000000..996eb075
--- /dev/null
+++ b/tests/f_dup/expect.1
@@ -0,0 +1,34 @@
+Pass 1: Checking inodes, blocks, and sizes
+Duplicate blocks found... invoking duplicate block passes.
+Pass 1B: Rescan for duplicate/bad blocks
+Duplicate/bad block(s) in inode 12: 25 26
+Duplicate/bad block(s) in inode 13: 25 26
+Pass 1C: Scan directories for inodes with dup blocks.
+Pass 1D: Reconciling duplicate blocks
+(There are 2 inodes containing duplicate/bad blocks.)
+
+File /motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+ has 2 duplicate blocks, shared with 1 file:
+ /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993)
+Clone duplicate/bad blocks? yes
+
+
+File /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993)
+ has 2 duplicate blocks, shared with 1 file:
+ /motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+Duplicated blocks already reassigned or cloned.
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (44, counted=60). FIXED
+Free blocks count wrong (62, counted=60). FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/16 files, 40/100 blocks
+Exit status is 1
diff --git a/tests/f_dup/expect.2 b/tests/f_dup/expect.2
new file mode 100644
index 00000000..e65d6922
--- /dev/null
+++ b/tests/f_dup/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/16 files, 40/100 blocks
+Exit status is 0
diff --git a/tests/f_dup/image.gz b/tests/f_dup/image.gz
new file mode 100644
index 00000000..3e04690e
--- /dev/null
+++ b/tests/f_dup/image.gz
Binary files differ
diff --git a/tests/f_dup/name b/tests/f_dup/name
new file mode 100644
index 00000000..6296b83f
--- /dev/null
+++ b/tests/f_dup/name
@@ -0,0 +1 @@
+blocks claimed by two different files
diff --git a/tests/f_dup2/expect.1 b/tests/f_dup2/expect.1
new file mode 100644
index 00000000..6625f2fc
--- /dev/null
+++ b/tests/f_dup2/expect.1
@@ -0,0 +1,42 @@
+Pass 1: Checking inodes, blocks, and sizes
+Duplicate blocks found... invoking duplicate block passes.
+Pass 1B: Rescan for duplicate/bad blocks
+Duplicate/bad block(s) in inode 12: 25 26
+Duplicate/bad block(s) in inode 13: 25 26 57 58
+Duplicate/bad block(s) in inode 14: 57 58
+Pass 1C: Scan directories for inodes with dup blocks.
+Pass 1D: Reconciling duplicate blocks
+(There are 3 inodes containing duplicate/bad blocks.)
+
+File /pass1.c (inode #14, mod time Tue Sep 21 04:28:37 1993)
+ has 2 duplicate blocks, shared with 1 file:
+ /motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+Clone duplicate/bad blocks? yes
+
+
+File /motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+ has 4 duplicate blocks, shared with 2 files:
+ /pass1.c (inode #14, mod time Tue Sep 21 04:28:37 1993)
+ /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993)
+Clone duplicate/bad blocks? yes
+
+
+File /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993)
+ has 2 duplicate blocks, shared with 1 file:
+ /motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+Duplicated blocks already reassigned or cloned.
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (8, counted=22). FIXED
+Free blocks count wrong (26, counted=22). FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 16/16 files, 78/100 blocks
+Exit status is 1
diff --git a/tests/f_dup2/expect.2 b/tests/f_dup2/expect.2
new file mode 100644
index 00000000..0700500b
--- /dev/null
+++ b/tests/f_dup2/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/16 files, 78/100 blocks
+Exit status is 0
diff --git a/tests/f_dup2/image.gz b/tests/f_dup2/image.gz
new file mode 100644
index 00000000..e9b853d6
--- /dev/null
+++ b/tests/f_dup2/image.gz
Binary files differ
diff --git a/tests/f_dup2/name b/tests/f_dup2/name
new file mode 100644
index 00000000..3d636e0b
--- /dev/null
+++ b/tests/f_dup2/name
@@ -0,0 +1 @@
+blocks claimed by three different files
diff --git a/tests/f_dupfsblks/expect.1 b/tests/f_dupfsblks/expect.1
new file mode 100644
index 00000000..1ff77acb
--- /dev/null
+++ b/tests/f_dupfsblks/expect.1
@@ -0,0 +1,31 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 12? yes
+
+Block #1 (3) is the block bitmap of group 0. CLEARED
+Block #2 (4) is the inode bitmap of group 0. CLEARED
+Block #3 (6) is in the inode table of group 0. CLEARED
+Directory 12, incorrect size, 4096 (counted = 1024). Set size to counted? yes
+
+Inode 12, i_blocks wrong 8 (counted=2). Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+Directory inode 12 has a hole at block #1
+Allocate block? yes
+
+Directory inode 12 has a hole at block #2
+Allocate block? yes
+
+Directory inode 12 has a hole at block #3
+Allocate block? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (77, counted=74). FIXED
+Free blocks count wrong (77, counted=74). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 26/100 blocks
+Exit status is 1
diff --git a/tests/f_dupfsblks/expect.2 b/tests/f_dupfsblks/expect.2
new file mode 100644
index 00000000..e506f233
--- /dev/null
+++ b/tests/f_dupfsblks/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 26/100 blocks
+Exit status is 0
diff --git a/tests/f_dupfsblks/image.gz b/tests/f_dupfsblks/image.gz
new file mode 100644
index 00000000..5514de43
--- /dev/null
+++ b/tests/f_dupfsblks/image.gz
Binary files differ
diff --git a/tests/f_dupfsblks/name b/tests/f_dupfsblks/name
new file mode 100644
index 00000000..84124c9a
--- /dev/null
+++ b/tests/f_dupfsblks/name
@@ -0,0 +1 @@
+blocks claimed by a file and bitmaps or inode tables
diff --git a/tests/f_dupsuper/expect.1 b/tests/f_dupsuper/expect.1
new file mode 100644
index 00000000..274744a3
--- /dev/null
+++ b/tests/f_dupsuper/expect.1
@@ -0,0 +1,21 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 12? yes
+
+Block #4 (2) is in the group descriptors of group 0. CLEARED
+Block #5 (3) is the block bitmap of group 0. CLEARED
+Block #6 (1) is the superblock in group 0. CLEARED
+Inode 12, i_blocks wrong 34 (counted=28). Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -29 -30 -31. FIXED
+Free blocks count wrong for group 0 (61, counted=64). FIXED
+Free blocks count wrong (61, counted=64). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 36/100 blocks
+Exit status is 1
diff --git a/tests/f_dupsuper/expect.2 b/tests/f_dupsuper/expect.2
new file mode 100644
index 00000000..4ab97943
--- /dev/null
+++ b/tests/f_dupsuper/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 36/100 blocks
+Exit status is 0
diff --git a/tests/f_dupsuper/image.gz b/tests/f_dupsuper/image.gz
new file mode 100644
index 00000000..d919e07a
--- /dev/null
+++ b/tests/f_dupsuper/image.gz
Binary files differ
diff --git a/tests/f_dupsuper/name b/tests/f_dupsuper/name
new file mode 100644
index 00000000..560a707e
--- /dev/null
+++ b/tests/f_dupsuper/name
@@ -0,0 +1 @@
+blocks claimed by a file and superblock or group descriptors
diff --git a/tests/f_end-bitmap/expect.1 b/tests/f_end-bitmap/expect.1
new file mode 100644
index 00000000..71eb6b6a
--- /dev/null
+++ b/tests/f_end-bitmap/expect.1
@@ -0,0 +1,14 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (44, counted=63). FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/16 files, 37/100 blocks
+Exit status is 1
diff --git a/tests/f_end-bitmap/expect.2 b/tests/f_end-bitmap/expect.2
new file mode 100644
index 00000000..a4c2f736
--- /dev/null
+++ b/tests/f_end-bitmap/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/16 files, 37/100 blocks
+Exit status is 0
diff --git a/tests/f_end-bitmap/image.gz b/tests/f_end-bitmap/image.gz
new file mode 100644
index 00000000..cb20d0a2
--- /dev/null
+++ b/tests/f_end-bitmap/image.gz
Binary files differ
diff --git a/tests/f_end-bitmap/name b/tests/f_end-bitmap/name
new file mode 100644
index 00000000..16baec6a
--- /dev/null
+++ b/tests/f_end-bitmap/name
@@ -0,0 +1,2 @@
+corruption at end of block bitmap
+
diff --git a/tests/f_expand/expect.1 b/tests/f_expand/expect.1
new file mode 100644
index 00000000..11263585
--- /dev/null
+++ b/tests/f_expand/expect.1
@@ -0,0 +1,587 @@
+Pass 1: Checking inodes, blocks, and sizes
+Deleted inode 2 has zero dtime.
+Set dtime? yes
+
+Pass 2: Checking directory structure
+Entry '..' in /lost+found (11) has deleted/unused inode 2.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Root inode not allocated. Rellocate? yes
+
+Unconnected directory inode 11 (...)
+Connect to /lost+found? yes
+
+/lost+found not found. Create? yes
+
+Pass 4: Checking reference counts
+Inode 11 has ref count 3, expecting 2.
+Set i_nlinks to count? yes
+
+Unattached inode 12
+Connect to /lost+found? yes
+
+Inode 12 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 13
+Connect to /lost+found? yes
+
+Inode 13 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 14
+Connect to /lost+found? yes
+
+Inode 14 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 15
+Connect to /lost+found? yes
+
+Inode 15 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 16
+Connect to /lost+found? yes
+
+Inode 16 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 17
+Connect to /lost+found? yes
+
+Inode 17 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 18
+Connect to /lost+found? yes
+
+Inode 18 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 19
+Connect to /lost+found? yes
+
+Inode 19 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 20
+Connect to /lost+found? yes
+
+Inode 20 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 21
+Connect to /lost+found? yes
+
+Inode 21 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 22
+Connect to /lost+found? yes
+
+Inode 22 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 23
+Connect to /lost+found? yes
+
+Inode 23 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 24
+Connect to /lost+found? yes
+
+Inode 24 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 25
+Connect to /lost+found? yes
+
+Inode 25 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 26
+Connect to /lost+found? yes
+
+Inode 26 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 27
+Connect to /lost+found? yes
+
+Inode 27 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 28
+Connect to /lost+found? yes
+
+Inode 28 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 29
+Connect to /lost+found? yes
+
+Inode 29 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 30
+Connect to /lost+found? yes
+
+Inode 30 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 31
+Connect to /lost+found? yes
+
+Inode 31 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 32
+Connect to /lost+found? yes
+
+Inode 32 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 33
+Connect to /lost+found? yes
+
+Inode 33 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 34
+Connect to /lost+found? yes
+
+Inode 34 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 35
+Connect to /lost+found? yes
+
+Inode 35 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 36
+Connect to /lost+found? yes
+
+Inode 36 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 37
+Connect to /lost+found? yes
+
+Inode 37 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 38
+Connect to /lost+found? yes
+
+Inode 38 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 39
+Connect to /lost+found? yes
+
+Inode 39 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 40
+Connect to /lost+found? yes
+
+Inode 40 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 41
+Connect to /lost+found? yes
+
+Inode 41 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 42
+Connect to /lost+found? yes
+
+Inode 42 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 43
+Connect to /lost+found? yes
+
+Inode 43 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 44
+Connect to /lost+found? yes
+
+Inode 44 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 45
+Connect to /lost+found? yes
+
+Inode 45 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 46
+Connect to /lost+found? yes
+
+Inode 46 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 47
+Connect to /lost+found? yes
+
+Inode 47 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 48
+Connect to /lost+found? yes
+
+Inode 48 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 49
+Connect to /lost+found? yes
+
+Inode 49 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 50
+Connect to /lost+found? yes
+
+Inode 50 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 51
+Connect to /lost+found? yes
+
+Inode 51 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 52
+Connect to /lost+found? yes
+
+Inode 52 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 53
+Connect to /lost+found? yes
+
+Inode 53 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 54
+Connect to /lost+found? yes
+
+Inode 54 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 55
+Connect to /lost+found? yes
+
+Inode 55 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 56
+Connect to /lost+found? yes
+
+Inode 56 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 57
+Connect to /lost+found? yes
+
+Inode 57 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 58
+Connect to /lost+found? yes
+
+Inode 58 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 59
+Connect to /lost+found? yes
+
+Inode 59 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 60
+Connect to /lost+found? yes
+
+Inode 60 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 61
+Connect to /lost+found? yes
+
+Inode 61 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 62
+Connect to /lost+found? yes
+
+Inode 62 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 63
+Connect to /lost+found? yes
+
+Inode 63 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 64
+Connect to /lost+found? yes
+
+Inode 64 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 65
+Connect to /lost+found? yes
+
+Inode 65 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 66
+Connect to /lost+found? yes
+
+Inode 66 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 67
+Connect to /lost+found? yes
+
+Inode 67 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 68
+Connect to /lost+found? yes
+
+Inode 68 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 69
+Connect to /lost+found? yes
+
+Inode 69 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 70
+Connect to /lost+found? yes
+
+Inode 70 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 71
+Connect to /lost+found? yes
+
+Inode 71 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 72
+Connect to /lost+found? yes
+
+Inode 72 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 73
+Connect to /lost+found? yes
+
+Inode 73 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 74
+Connect to /lost+found? yes
+
+Inode 74 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 75
+Connect to /lost+found? yes
+
+Inode 75 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 76
+Connect to /lost+found? yes
+
+Inode 76 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 77
+Connect to /lost+found? yes
+
+Inode 77 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 78
+Connect to /lost+found? yes
+
+Inode 78 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 79
+Connect to /lost+found? yes
+
+Inode 79 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 80
+Connect to /lost+found? yes
+
+Inode 80 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 81
+Connect to /lost+found? yes
+
+Inode 81 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 82
+Connect to /lost+found? yes
+
+Inode 82 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 83
+Connect to /lost+found? yes
+
+Inode 83 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 84
+Connect to /lost+found? yes
+
+Inode 84 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 85
+Connect to /lost+found? yes
+
+Inode 85 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 86
+Connect to /lost+found? yes
+
+Inode 86 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 87
+Connect to /lost+found? yes
+
+Inode 87 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 88
+Connect to /lost+found? yes
+
+Inode 88 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 89
+Connect to /lost+found? yes
+
+Inode 89 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 90
+Connect to /lost+found? yes
+
+Inode 90 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 91
+Connect to /lost+found? yes
+
+Inode 91 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 92
+Connect to /lost+found? yes
+
+Inode 92 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 93
+Connect to /lost+found? yes
+
+Inode 93 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 94
+Connect to /lost+found? yes
+
+No room in /lost+found; expand /lost+found? yes
+
+Inode 94 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 95
+Connect to /lost+found? yes
+
+Inode 95 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 96
+Connect to /lost+found? yes
+
+Inode 96 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 97
+Connect to /lost+found? yes
+
+Inode 97 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 98
+Connect to /lost+found? yes
+
+Inode 98 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 99
+Connect to /lost+found? yes
+
+Inode 99 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 100
+Connect to /lost+found? yes
+
+Inode 100 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 102
+Connect to /lost+found? yes
+
+Inode 102 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 103
+Connect to /lost+found? yes
+
+Inode 103 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 104
+Connect to /lost+found? yes
+
+Inode 104 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -33. FIXED
+Free blocks count wrong for group 0 (68, counted=67). FIXED
+Free blocks count wrong (68, counted=67). FIXED
+Free inodes count wrong for group #0 (1, counted=0). FIXED
+Directories count wrong for group #0 (2, counted=3). FIXED
+Free inodes count wrong (1, counted=0). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 104/104 files, 33/100 blocks
+Exit status is 1
diff --git a/tests/f_expand/expect.2 b/tests/f_expand/expect.2
new file mode 100644
index 00000000..49395f23
--- /dev/null
+++ b/tests/f_expand/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 104/104 files, 33/100 blocks
+Exit status is 0
diff --git a/tests/f_expand/image.gz b/tests/f_expand/image.gz
new file mode 100644
index 00000000..e79eb327
--- /dev/null
+++ b/tests/f_expand/image.gz
Binary files differ
diff --git a/tests/f_expand/name b/tests/f_expand/name
new file mode 100644
index 00000000..feebe0fc
--- /dev/null
+++ b/tests/f_expand/name
@@ -0,0 +1 @@
+expanding lost+found
diff --git a/tests/f_holedir/expect.1 b/tests/f_holedir/expect.1
new file mode 100644
index 00000000..b0af9488
--- /dev/null
+++ b/tests/f_holedir/expect.1
@@ -0,0 +1,31 @@
+Pass 1: Checking inodes, blocks, and sizes
+Hole found in directory inode 11! (blkcnt=0)
+Hole found in directory inode 11! (blkcnt=3)
+Remove illegal block(s) in inode 11? yes
+
+Block #6 (200) > BLOCKS (100). CLEARED
+Hole found in directory inode 11! (blkcnt=11)
+Directory 11, incorrect size, 12288 (counted = 11264). Set size to counted? yes
+
+Inode 11, i_blocks wrong 24 (counted=16). Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+Directory inode 11 has a hole at block #0
+Allocate block? yes
+
+Directory inode 11 has a hole at block #3
+Allocate block? yes
+
+Directory inode 11 has a hole at block #6
+Allocate block? yes
+
+Directory inode 11 has a hole at block #11
+Allocate block? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_holedir/expect.2 b/tests/f_holedir/expect.2
new file mode 100644
index 00000000..b8b19f83
--- /dev/null
+++ b/tests/f_holedir/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_holedir/image.gz b/tests/f_holedir/image.gz
new file mode 100644
index 00000000..ee26ab8d
--- /dev/null
+++ b/tests/f_holedir/image.gz
Binary files differ
diff --git a/tests/f_holedir/name b/tests/f_holedir/name
new file mode 100644
index 00000000..411f656f
--- /dev/null
+++ b/tests/f_holedir/name
@@ -0,0 +1 @@
+directory with holes and illegal blocks
diff --git a/tests/f_illbbitmap/expect.1 b/tests/f_illbbitmap/expect.1
new file mode 100644
index 00000000..4b3b6c32
--- /dev/null
+++ b/tests/f_illbbitmap/expect.1
@@ -0,0 +1,19 @@
+Block bitmap for group 0 is not in group. (block 4096)
+Relocate? yes
+
+Pass 1: Checking inodes, blocks, and sizes
+Relocating group 0's block bitmap to 4...
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21. FIXED
+Inode bitmap differences: -12 -13 -14 -15 -16 -17 -18 -19 -20 -21. FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_illbbitmap/expect.2 b/tests/f_illbbitmap/expect.2
new file mode 100644
index 00000000..b8b19f83
--- /dev/null
+++ b/tests/f_illbbitmap/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_illbbitmap/image.gz b/tests/f_illbbitmap/image.gz
new file mode 100644
index 00000000..fb16ebc4
--- /dev/null
+++ b/tests/f_illbbitmap/image.gz
Binary files differ
diff --git a/tests/f_illbbitmap/name b/tests/f_illbbitmap/name
new file mode 100644
index 00000000..5ed4f591
--- /dev/null
+++ b/tests/f_illbbitmap/name
@@ -0,0 +1 @@
+illegal block bitmap
diff --git a/tests/f_illibitmap/expect.1 b/tests/f_illibitmap/expect.1
new file mode 100644
index 00000000..15fe3931
--- /dev/null
+++ b/tests/f_illibitmap/expect.1
@@ -0,0 +1,16 @@
+Inode bitmap group 0 not in group. (block 4000)
+Relocate? yes
+
+Pass 1: Checking inodes, blocks, and sizes
+Relocating group 0's inode bitmap to 4...
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Inode bitmap differences: +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11. FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_illibitmap/expect.2 b/tests/f_illibitmap/expect.2
new file mode 100644
index 00000000..b8b19f83
--- /dev/null
+++ b/tests/f_illibitmap/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_illibitmap/image.gz b/tests/f_illibitmap/image.gz
new file mode 100644
index 00000000..3e0892d4
--- /dev/null
+++ b/tests/f_illibitmap/image.gz
Binary files differ
diff --git a/tests/f_illibitmap/name b/tests/f_illibitmap/name
new file mode 100644
index 00000000..bac40035
--- /dev/null
+++ b/tests/f_illibitmap/name
@@ -0,0 +1 @@
+illegal inode bitmap
diff --git a/tests/f_lotsbad/expect.1 b/tests/f_lotsbad/expect.1
new file mode 100644
index 00000000..33079f1e
--- /dev/null
+++ b/tests/f_lotsbad/expect.1
@@ -0,0 +1,46 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 12? yes
+
+Block #12 (778398818) > BLOCKS (100). CLEARED
+Block #13 (1768444960) > BLOCKS (100). CLEARED
+Block #14 (1752375411) > BLOCKS (100). CLEARED
+Block #15 (1684829551) > BLOCKS (100). CLEARED
+Block #16 (1886349344) > BLOCKS (100). CLEARED
+Block #17 (1819633253) > BLOCKS (100). CLEARED
+Block #18 (1663072620) > BLOCKS (100). CLEARED
+Block #19 (1735287144) > BLOCKS (100). CLEARED
+Block #20 (1310731877) > BLOCKS (100). CLEARED
+Block #21 (560297071) > BLOCKS (100). CLEARED
+Block #22 (543512352) > BLOCKS (100). CLEARED
+Block #23 (1869835361) > BLOCKS (100). CLEARED
+Block #24 (1634231072) > BLOCKS (100). CLEARED
+Block #25 (543516526) > BLOCKS (100). CLEARED
+Block #26 (174418036) > BLOCKS (100). CLEARED
+Block #27 (1919819811) > BLOCKS (100). CLEARED
+Block #28 (543584032) > BLOCKS (100). CLEARED
+Block #29 (1701734764) > BLOCKS (100). CLEARED
+Block #30 (1869881459) > BLOCKS (100). CLEARED
+Too many illegal blocks in inode 12.
+Clear inode? yes
+
+Restarting e2fsck from the beginning...
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Entry 'termcap' in / (2) has deleted/unused inode 12.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -44 -45. FIXED
+Free blocks count wrong for group 0 (41, counted=58). FIXED
+Free blocks count wrong (41, counted=58). FIXED
+Inode bitmap differences: -12. FIXED
+Free inodes count wrong for group #0 (20, counted=21). FIXED
+Free inodes count wrong (20, counted=21). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 42/100 blocks
+Exit status is 1
diff --git a/tests/f_lotsbad/expect.2 b/tests/f_lotsbad/expect.2
new file mode 100644
index 00000000..3257a84e
--- /dev/null
+++ b/tests/f_lotsbad/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 42/100 blocks
+Exit status is 0
diff --git a/tests/f_lotsbad/image.gz b/tests/f_lotsbad/image.gz
new file mode 100644
index 00000000..9386a9e9
--- /dev/null
+++ b/tests/f_lotsbad/image.gz
Binary files differ
diff --git a/tests/f_lotsbad/name b/tests/f_lotsbad/name
new file mode 100644
index 00000000..16b77c10
--- /dev/null
+++ b/tests/f_lotsbad/name
@@ -0,0 +1 @@
+too many illegal blocks in inode
diff --git a/tests/f_lpf/expect.1 b/tests/f_lpf/expect.1
new file mode 100644
index 00000000..b2cef783
--- /dev/null
+++ b/tests/f_lpf/expect.1
@@ -0,0 +1,39 @@
+Pass 1: Checking inodes, blocks, and sizes
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.
+Fix inode(s)? yes
+
+Inode 11 is deleted w/ non-zero link_count. CLEARED
+Inode 13 is deleted w/ non-zero link_count. CLEARED
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Unattached inode 14
+Connect to /lost+found? yes
+
+/lost+found not found. Create? yes
+
+Inode 14 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 15
+Connect to /lost+found? yes
+
+Inode 15 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (25, counted=38). FIXED
+Free blocks count wrong (39, counted=38). FIXED
+Free inodes count wrong for group #0 (2, counted=1). FIXED
+Directories count wrong for group #0 (1, counted=2). FIXED
+Free inodes count wrong (2, counted=1). FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 15/16 files, 62/100 blocks
+Exit status is 1
diff --git a/tests/f_lpf/expect.2 b/tests/f_lpf/expect.2
new file mode 100644
index 00000000..800fd55a
--- /dev/null
+++ b/tests/f_lpf/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 15/16 files, 62/100 blocks
+Exit status is 0
diff --git a/tests/f_lpf/image.gz b/tests/f_lpf/image.gz
new file mode 100644
index 00000000..659b2785
--- /dev/null
+++ b/tests/f_lpf/image.gz
Binary files differ
diff --git a/tests/f_lpf/name b/tests/f_lpf/name
new file mode 100644
index 00000000..ac2dbab4
--- /dev/null
+++ b/tests/f_lpf/name
@@ -0,0 +1 @@
+missing lost+found
diff --git a/tests/f_messy_inode/expect.1 b/tests/f_messy_inode/expect.1
new file mode 100644
index 00000000..170bac9e
--- /dev/null
+++ b/tests/f_messy_inode/expect.1
@@ -0,0 +1,33 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 14? yes
+
+Block #2 (4294901760) > BLOCKS (100). CLEARED
+Block #3 (4294901760) > BLOCKS (100). CLEARED
+Block #4 (4294901760) > BLOCKS (100). CLEARED
+Block #5 (4294901760) > BLOCKS (100). CLEARED
+Block #6 (4294901760) > BLOCKS (100). CLEARED
+Block #7 (4294901760) > BLOCKS (100). CLEARED
+Block #8 (4294901760) > BLOCKS (100). CLEARED
+Block #9 (4294901760) > BLOCKS (100). CLEARED
+Block #10 (4294901760) > BLOCKS (100). CLEARED
+Inode 14, i_blocks wrong 18 (counted=4). Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+i_file_acl for inode 14 (/MAKEDEV) is 4294901760, should be zero.
+Clear i_file_acl? yes
+
+i_dir_acl for inode 14 (/MAKEDEV) is 4294901760, should be zero.
+Clear i_dir_acl? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -43 -44 -45 -46 -47 -48 -49. FIXED
+Free blocks count wrong for group 0 (68, counted=75). FIXED
+Free blocks count wrong (68, counted=75). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 29/32 files, 25/100 blocks
+Exit status is 1
diff --git a/tests/f_messy_inode/expect.2 b/tests/f_messy_inode/expect.2
new file mode 100644
index 00000000..e9c78809
--- /dev/null
+++ b/tests/f_messy_inode/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 29/32 files, 25/100 blocks
+Exit status is 0
diff --git a/tests/f_messy_inode/image.gz b/tests/f_messy_inode/image.gz
new file mode 100644
index 00000000..630a6898
--- /dev/null
+++ b/tests/f_messy_inode/image.gz
Binary files differ
diff --git a/tests/f_messy_inode/name b/tests/f_messy_inode/name
new file mode 100644
index 00000000..f1485eae
--- /dev/null
+++ b/tests/f_messy_inode/name
@@ -0,0 +1 @@
+bad file and directory acl pointers
diff --git a/tests/f_mke2fs2b/expect.1 b/tests/f_mke2fs2b/expect.1
new file mode 100644
index 00000000..e60580c5
--- /dev/null
+++ b/tests/f_mke2fs2b/expect.1
@@ -0,0 +1,36 @@
+Pass 1: Checking inodes, blocks, and sizes
+Root inode has dtime set (probably due to old mke2fs). Fix? yes
+
+Note: /lost+found will probably be deleted as well, due to the mke2fs bug.
+Be sure to run mklost+found to recreate it after e2fsck finishes.
+
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.
+Fix inode(s)? yes
+
+Inode 11 is deleted w/ non-zero link_count. CLEARED
+Inode 15 is deleted w/ non-zero link_count. CLEARED
+Pass 2: Checking directory structure
+Entry 'lost+found' in / (2) has deleted/unused inode 11.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Inode 2 has ref count 4, expecting 3.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20. FIXED
+Free blocks count wrong for group 0 (75, counted=87). FIXED
+Free blocks count wrong (75, counted=87). FIXED
+Inode bitmap differences: -11. FIXED
+Free inodes count wrong for group #0 (17, counted=18). FIXED
+Directories count wrong for group #0 (4, counted=3). FIXED
+Free inodes count wrong (17, counted=18). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 14/32 files, 13/100 blocks
+Exit status is 1
diff --git a/tests/f_mke2fs2b/expect.2 b/tests/f_mke2fs2b/expect.2
new file mode 100644
index 00000000..447fcb58
--- /dev/null
+++ b/tests/f_mke2fs2b/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 14/32 files, 13/100 blocks
+Exit status is 0
diff --git a/tests/f_mke2fs2b/image.gz b/tests/f_mke2fs2b/image.gz
new file mode 100644
index 00000000..6b7412cd
--- /dev/null
+++ b/tests/f_mke2fs2b/image.gz
Binary files differ
diff --git a/tests/f_mke2fs2b/name b/tests/f_mke2fs2b/name
new file mode 100644
index 00000000..bf2202ac
--- /dev/null
+++ b/tests/f_mke2fs2b/name
@@ -0,0 +1 @@
+mke2fs version 0.2b created filesystem
diff --git a/tests/f_noroot/expect.1 b/tests/f_noroot/expect.1
new file mode 100644
index 00000000..df77568c
--- /dev/null
+++ b/tests/f_noroot/expect.1
@@ -0,0 +1,44 @@
+Pass 1: Checking inodes, blocks, and sizes
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.
+Fix inode(s)? yes
+
+Inode 15 is deleted w/ non-zero link_count. CLEARED
+Pass 2: Checking directory structure
+Entry '..' in /lost+found (11) has deleted/unused inode 2.
+Clear? yes
+
+Entry '..' in /foo (12) has deleted/unused inode 2.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Root inode not allocated. Rellocate? yes
+
+Unconnected directory inode 11 (...)
+Connect to /lost+found? yes
+
+/lost+found not found. Create? yes
+
+Unconnected directory inode 12 (...)
+Connect to /lost+found? yes
+
+Pass 4: Checking reference counts
+Inode 11 has ref count 3, expecting 2.
+Set i_nlinks to count? yes
+
+Inode 12 has ref count 4, expecting 3.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (75, counted=74). FIXED
+Free blocks count wrong (75, counted=74). FIXED
+Free inodes count wrong for group #0 (17, counted=16). FIXED
+Directories count wrong for group #0 (4, counted=5). FIXED
+Free inodes count wrong (17, counted=16). FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 16/32 files, 26/100 blocks
+Exit status is 1
diff --git a/tests/f_noroot/expect.2 b/tests/f_noroot/expect.2
new file mode 100644
index 00000000..8cf7758c
--- /dev/null
+++ b/tests/f_noroot/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/32 files, 26/100 blocks
+Exit status is 0
diff --git a/tests/f_noroot/image.gz b/tests/f_noroot/image.gz
new file mode 100644
index 00000000..0a87e996
--- /dev/null
+++ b/tests/f_noroot/image.gz
Binary files differ
diff --git a/tests/f_noroot/name b/tests/f_noroot/name
new file mode 100644
index 00000000..a70ebc29
--- /dev/null
+++ b/tests/f_noroot/name
@@ -0,0 +1 @@
+missing root directory
diff --git a/tests/f_okgroup/expect.1 b/tests/f_okgroup/expect.1
new file mode 100644
index 00000000..8ee1a4b8
--- /dev/null
+++ b/tests/f_okgroup/expect.1
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/2048 files, 274/8193 blocks
+Exit status is 0
diff --git a/tests/f_okgroup/expect.2 b/tests/f_okgroup/expect.2
new file mode 100644
index 00000000..8ee1a4b8
--- /dev/null
+++ b/tests/f_okgroup/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/2048 files, 274/8193 blocks
+Exit status is 0
diff --git a/tests/f_okgroup/image.gz b/tests/f_okgroup/image.gz
new file mode 100644
index 00000000..06b67c7a
--- /dev/null
+++ b/tests/f_okgroup/image.gz
Binary files differ
diff --git a/tests/f_okgroup/name b/tests/f_okgroup/name
new file mode 100644
index 00000000..3da66af8
--- /dev/null
+++ b/tests/f_okgroup/name
@@ -0,0 +1 @@
+8193 block long filesystem
diff --git a/tests/f_overfsblks/expect.1 b/tests/f_overfsblks/expect.1
new file mode 100644
index 00000000..91c9ae2c
--- /dev/null
+++ b/tests/f_overfsblks/expect.1
@@ -0,0 +1,16 @@
+Pass 1: Checking inodes, blocks, and sizes
+Group 0's inode bitmap at 3 conflicts with some other fs block.
+Relocate? yes
+
+Relocating group 0's inode bitmap from 3 to 4...
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Inode bitmap differences: -12 -13 -14 -15 -16 -17 -18 -19 -20 -21. FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_overfsblks/expect.2 b/tests/f_overfsblks/expect.2
new file mode 100644
index 00000000..b8b19f83
--- /dev/null
+++ b/tests/f_overfsblks/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_overfsblks/image.gz b/tests/f_overfsblks/image.gz
new file mode 100644
index 00000000..60b6b2ea
--- /dev/null
+++ b/tests/f_overfsblks/image.gz
Binary files differ
diff --git a/tests/f_overfsblks/name b/tests/f_overfsblks/name
new file mode 100644
index 00000000..8ab60408
--- /dev/null
+++ b/tests/f_overfsblks/name
@@ -0,0 +1 @@
+overlapping inode and block bitmaps
diff --git a/tests/run_e2fsck b/tests/run_e2fsck
new file mode 100644
index 00000000..4923c662
--- /dev/null
+++ b/tests/run_e2fsck
@@ -0,0 +1,72 @@
+if [ "$IMAGE"x = x ]; then
+ IMAGE=$test_dir/image.gz
+fi
+
+if [ "$FSCK_OPT"x = x ]; then
+ FSCK_OPT=-yf
+fi
+
+if [ "$SECOND_FSCK_OPT"x = x ]; then
+ SECOND_FSCK_OPT=-yf
+fi
+
+if [ "$OUT1"x = x ]; then
+ OUT1=$test_name.1.log
+fi
+
+if [ "$OUT2"x = x ]; then
+ OUT2=$test_name.2.log
+fi
+
+if [ "$EXP1"x = x ]; then
+ EXP1=$test_dir/expect.1
+fi
+
+if [ "$EXP2"x = x ]; then
+ EXP2=$test_dir/expect.2
+fi
+
+gunzip < $IMAGE > $TMPFILE
+
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT1.new
+sed -e '1d' $OUT1.new > $OUT1
+rm -f $OUT1.new
+
+if [ "$ONE_PASS_ONLY" != "true" ]; then
+ $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
+ status=$?
+ echo Exit status is $status >> $OUT2.new
+ sed -e '1d' $OUT2.new > $OUT2
+ rm -f $OUT2.new
+fi
+
+rm $TMPFILE
+
+if [ "$SKIP_VERIFY" != "true" ] ; then
+ rm -f $test_name.ok $test_name.failed
+ cmp -s $OUT1 $EXP1
+ status1=$?
+ if [ "$ONE_PASS_ONLY" != "true" ]; then
+ cmp -s $OUT2 $EXP2
+ status2=$?
+ else
+ status2=0
+ fi
+
+ if [ "$status1" = 0 -a "$status2" = 0 ] ; then
+ echo "ok"
+ touch $test_name.ok
+ else
+ echo "failed"
+ diff -c $EXP1 $OUT1 > $test_name.failed
+ if [ "$ONE_PASS_ONLY" != "true" ]; then
+ diff -c $EXP2 $OUT2 >> $test_name.failed
+ fi
+ fi
+fi
+
+if [ "$SKIP_CLEANUP" != "true" ] ; then
+ unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
+fi
diff --git a/tests/test_config b/tests/test_config
new file mode 100644
index 00000000..86a5bde6
--- /dev/null
+++ b/tests/test_config
@@ -0,0 +1,9 @@
+#
+# Test configuration
+#
+
+FSCK=../e2fsck/e2fsck
+LD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss
+export LD_LIBRARY_PATH
+TZ=GMT
+export TZ
diff --git a/tests/test_script b/tests/test_script
new file mode 100644
index 00000000..dc104f43
--- /dev/null
+++ b/tests/test_script
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Test script for e2fsck
+#
+
+if test "$1"x = x ; then
+SRCDIR=.
+else
+SRCDIR=$1
+fi
+
+cmd_dir=$SRCDIR
+TMPFILE=./test.img
+
+. $SRCDIR/test_config
+
+for test_dir in $SRCDIR/[a-zA-Z]_*
+do
+ test_name=`echo $test_dir | sed -e 's;.*/;;'`
+ if [ -f $test_dir/name ]; then
+ test_description=`cat $test_dir/name`
+ echo -n "$test_name: $test_description: "
+ else
+ echo -n "$test_name: "
+ fi
+ if [ -f $test_dir/script ]; then
+ . $test_dir/script
+ else
+ test_base=`echo $test_name | sed -e 's/_.*//'`
+ default_script=$SRCDIR/defaults/${test_base}_script
+ if [ -f $default_script ]; then
+ . $SRCDIR/defaults/${test_base}_script
+ else
+ echo "Missing test script!"
+ fi
+ fi
+done
+
+num_ok=`ls *.ok | wc -l`
+num_failed=`ls *.failed 2>/dev/null | wc -l`
+
+echo "$num_ok tests succeeded $num_failed tests failed"
+