misc: add plausibility checks to debugfs/tune2fs/dumpe2fs/e2fsck

If any of these utilities detect a bad superblock magic, call
check_plausibility to see if blkid can identify the passed-in argument
as something else (xfs, partition, etc.) in the hopes of catching a
user error.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Darrick J. Wong 2014-09-13 15:12:39 -07:00 committed by Theodore Ts'o
parent b598c517b3
commit c8b20b40eb
15 changed files with 227 additions and 88 deletions

View File

@ -19,11 +19,12 @@ MK_CMDS= _SS_DIR_OVERRIDE=../lib/ss ../lib/ss/mk_cmds
DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o ls.o \
lsdel.o dump.o set_fields.o logdump.o htree.o unused.o e2freefrag.o \
filefrag.o extent_cmds.o extent_inode.o zap.o create_inode.o \
quota.o xattrs.o journal.o revoke.o recovery.o do_journal.o
quota.o xattrs.o journal.o revoke.o recovery.o do_journal.o \
plausible.o
RO_DEBUG_OBJS= ro_debug_cmds.o ro_debugfs.o util.o ncheck.o icheck.o ls.o \
lsdel.o logdump.o htree.o e2freefrag.o filefrag.o extent_cmds.o \
extent_inode.o quota.o xattrs.o
extent_inode.o quota.o xattrs.o ../misc/plausible.o
SRCS= debug_cmds.c $(srcdir)/debugfs.c $(srcdir)/util.c $(srcdir)/ls.c \
$(srcdir)/ncheck.c $(srcdir)/icheck.c $(srcdir)/lsdel.c \
@ -32,7 +33,8 @@ SRCS= debug_cmds.c $(srcdir)/debugfs.c $(srcdir)/util.c $(srcdir)/ls.c \
$(srcdir)/filefrag.c $(srcdir)/extent_inode.c $(srcdir)/zap.c \
$(srcdir)/../misc/create_inode.c $(srcdir)/xattrs.c $(srcdir)/quota.c \
$(srcdir)/journal.c $(srcdir)/../e2fsck/revoke.c \
$(srcdir)/../e2fsck/recovery.c $(srcdir)/do_journal.c
$(srcdir)/../e2fsck/recovery.c $(srcdir)/do_journal.c \
$(srcdir)/../misc/plausible.c
LIBS= $(LIBQUOTA) $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBBLKID) \
$(LIBUUID) $(SYSLIBS)
@ -59,6 +61,10 @@ DEPEND_CFLAGS = -I$(srcdir)
all:: $(PROGS) $(MANPAGES)
plausible.o: $(top_srcdir)/misc/plausible.c
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
debugfs: $(DEBUG_OBJS) $(DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o debugfs $(DEBUG_OBJS) $(LIBS)
@ -172,7 +178,8 @@ debugfs.o: $(srcdir)/debugfs.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h $(top_srcdir)/version.h \
$(srcdir)/../e2fsck/jfs_user.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h \
$(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h
$(top_srcdir)/lib/ext2fs/jfs_compat.h $(top_srcdir)/lib/ext2fs/kernel-list.h \
$(srcdir)/../misc/plausible.h
util.o: $(srcdir)/util.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ss/ss.h \
$(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \
@ -398,3 +405,11 @@ do_journal.o: $(srcdir)/do_journal.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/../e2fsck/jfs_user.h \
$(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
$(top_srcdir)/lib/ext2fs/kernel-list.h
plausible.o: $(srcdir)/../misc/plausible.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
$(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
$(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h \
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
$(srcdir)/../misc/nls-enable.h $(srcdir)/../misc/plausible.h

View File

@ -34,6 +34,7 @@ extern char *optarg;
#include "../version.h"
#include "jfs_user.h"
#include "../misc/plausible.h"
#ifndef BUFSIZ
#define BUFSIZ 8192
@ -87,6 +88,8 @@ static void open_filesystem(char *device, int open_flags, blk64_t superblock,
unix_io_manager, &current_fs);
if (retval) {
com_err(device, retval, "while opening filesystem");
if (retval == EXT2_ET_BAD_MAGIC)
check_plausibility(device, CHECK_FS_EXIST, NULL);
current_fs = NULL;
return;
}

View File

@ -62,7 +62,7 @@ OBJS= dict.o unix.o e2fsck.o super.o pass1.o pass1b.o pass2.o \
pass3.o pass4.o pass5.o journal.o badblocks.o util.o dirinfo.o \
dx_dirinfo.o ehandler.o problem.o message.o quota.o recovery.o \
region.o revoke.o ea_refcount.o rehash.o profile.o prof_err.o \
logfile.o sigcatcher.o $(MTRACE_OBJ)
logfile.o sigcatcher.o $(MTRACE_OBJ) plausible.o
PROFILED_OBJS= profiled/dict.o profiled/unix.o profiled/e2fsck.o \
profiled/super.o profiled/pass1.o profiled/pass1b.o \
@ -73,7 +73,7 @@ PROFILED_OBJS= profiled/dict.o profiled/unix.o profiled/e2fsck.o \
profiled/recovery.o profiled/region.o profiled/revoke.o \
profiled/ea_refcount.o profiled/rehash.o profiled/profile.o \
profiled/prof_err.o profiled/logfile.o \
profiled/sigcatcher.o
profiled/sigcatcher.o profiled/plausible.o
SRCS= $(srcdir)/e2fsck.c \
$(srcdir)/dict.c \
@ -103,12 +103,20 @@ SRCS= $(srcdir)/e2fsck.c \
$(srcdir)/logfile.c \
prof_err.c \
$(srcdir)/quota.c \
$(srcdir)/../misc/plausible.c \
$(MTRACE_SRC)
all:: profiled $(PROGS) e2fsck $(MANPAGES) $(FMANPAGES)
@PROFILE_CMT@all:: e2fsck.profiled
plausible.o: $(top_srcdir)/misc/plausible.c
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
$(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
prof_err.c prof_err.h: prof_err.et
$(E) " COMPILE_ET prof_err.et"
$(Q) $(COMPILE_ET) $(srcdir)/prof_err.et
@ -410,7 +418,7 @@ unix.o: $(srcdir)/unix.c $(top_builddir)/lib/config.h \
$(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h \
$(top_srcdir)/version.h
$(top_srcdir)/version.h $(srcdir)/../misc/plausible.h
dirinfo.o: $(srcdir)/dirinfo.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(srcdir)/e2fsck.h \
$(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \
@ -525,3 +533,11 @@ quota.o: $(srcdir)/quota.c $(top_builddir)/lib/config.h \
$(srcdir)/profile.h prof_err.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/problem.h
plausible.o: $(srcdir)/../misc/plausible.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
$(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
$(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h \
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/bitops.h \
$(srcdir)/../misc/nls-enable.h $(srcdir)/../misc/plausible.h

View File

@ -126,7 +126,7 @@ static struct e2fsck_problem problem_table[] = {
" e2fsck -b 8193 <@v>\n"
" or\n"
" e2fsck -b 32768 <@v>\n\n"),
PROMPT_NONE, PR_FATAL },
PROMPT_NONE, 0 },
/* Filesystem size is wrong */
{ PR_0_FS_SIZE_WRONG,

View File

@ -52,6 +52,7 @@ extern int optind;
#include "e2fsck.h"
#include "problem.h"
#include "../version.h"
#include "../misc/plausible.h"
/* Command line options */
static int cflag; /* check disk */
@ -1382,8 +1383,12 @@ failure:
"-n option to do a read-only\n"
"check of the device.\n"));
#endif
else
else {
fix_problem(ctx, PR_0_SB_CORRUPT, &pctx);
if (retval == EXT2_ET_BAD_MAGIC)
check_plausibility(ctx->filesystem_name,
CHECK_FS_EXIST, NULL);
}
fatal_error(ctx, 0);
}
/*

View File

@ -1092,9 +1092,8 @@ tst_libext2fs.o: $(srcdir)/tst_libext2fs.c $(top_builddir)/lib/config.h \
$(srcdir)/bitops.h $(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
$(top_srcdir)/debugfs/debugfs.h $(srcdir)/ext2fs.h \
$(top_srcdir)/debugfs/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \
$(top_srcdir)/debugfs/../misc/nls-enable.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
debug_cmds.o: debug_cmds.c $(top_srcdir)/lib/ss/ss.h \
$(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
extent_cmds.o: extent_cmds.c $(top_srcdir)/lib/ss/ss.h \
@ -1109,11 +1108,12 @@ debugfs.o: $(top_srcdir)/debugfs/debugfs.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \
$(top_srcdir)/debugfs/../version.h $(srcdir)/../../e2fsck/jfs_user.h \
$(srcdir)/kernel-jbd.h $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h $(top_srcdir)/debugfs/../version.h \
$(srcdir)/../../e2fsck/jfs_user.h $(srcdir)/kernel-jbd.h \
$(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h \
$(top_srcdir)/debugfs/../misc/plausible.h
util.o: $(top_srcdir)/debugfs/util.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/ss/ss.h \
$(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h \
@ -1122,9 +1122,9 @@ util.o: $(top_srcdir)/debugfs/util.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
ncheck.o: $(top_srcdir)/debugfs/ncheck.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1133,9 +1133,9 @@ ncheck.o: $(top_srcdir)/debugfs/ncheck.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
icheck.o: $(top_srcdir)/debugfs/icheck.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1144,9 +1144,9 @@ icheck.o: $(top_srcdir)/debugfs/icheck.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
ls.o: $(top_srcdir)/debugfs/ls.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1155,9 +1155,9 @@ ls.o: $(top_srcdir)/debugfs/ls.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
lsdel.o: $(top_srcdir)/debugfs/lsdel.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1166,9 +1166,9 @@ lsdel.o: $(top_srcdir)/debugfs/lsdel.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
dump.o: $(top_srcdir)/debugfs/dump.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1177,9 +1177,9 @@ dump.o: $(top_srcdir)/debugfs/dump.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
set_fields.o: $(top_srcdir)/debugfs/set_fields.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1188,9 +1188,9 @@ set_fields.o: $(top_srcdir)/debugfs/set_fields.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
logdump.o: $(top_srcdir)/debugfs/logdump.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1199,11 +1199,10 @@ logdump.o: $(top_srcdir)/debugfs/logdump.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \
$(srcdir)/../../e2fsck/jfs_user.h $(srcdir)/kernel-jbd.h \
$(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/../../e2fsck/jfs_user.h \
$(srcdir)/kernel-jbd.h $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h
htree.o: $(top_srcdir)/debugfs/htree.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1212,9 +1211,9 @@ htree.o: $(top_srcdir)/debugfs/htree.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
unused.o: $(top_srcdir)/debugfs/unused.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1223,9 +1222,9 @@ unused.o: $(top_srcdir)/debugfs/unused.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
filefrag.o: $(top_srcdir)/debugfs/filefrag.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1234,9 +1233,9 @@ filefrag.o: $(top_srcdir)/debugfs/filefrag.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
extent_inode.o: $(top_srcdir)/debugfs/extent_inode.c \
$(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \
$(top_srcdir)/debugfs/debugfs.h $(top_srcdir)/lib/ss/ss.h \
@ -1245,9 +1244,9 @@ extent_inode.o: $(top_srcdir)/debugfs/extent_inode.c \
$(srcdir)/ext2fs.h $(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
zap.o: $(top_srcdir)/debugfs/zap.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1256,9 +1255,9 @@ zap.o: $(top_srcdir)/debugfs/zap.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
quota.o: $(top_srcdir)/debugfs/quota.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1267,9 +1266,9 @@ quota.o: $(top_srcdir)/debugfs/quota.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
xattrs.o: $(top_srcdir)/debugfs/xattrs.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/debugfs/debugfs.h \
$(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
@ -1278,9 +1277,9 @@ xattrs.o: $(top_srcdir)/debugfs/xattrs.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
e2freefrag.o: $(top_srcdir)/misc/e2freefrag.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
$(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
@ -1289,9 +1288,9 @@ e2freefrag.o: $(top_srcdir)/misc/e2freefrag.c $(top_builddir)/lib/config.h \
$(srcdir)/bitops.h $(top_srcdir)/misc/e2freefrag.h \
$(top_srcdir)/debugfs/debugfs.h $(top_srcdir)/lib/ss/ss.h \
$(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h
create_inode.o: $(top_srcdir)/misc/create_inode.c \
$(top_srcdir)/misc/create_inode.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/e2p/e2p.h $(srcdir)/ext2_fs.h \
@ -1326,8 +1325,13 @@ do_journal.o: $(top_srcdir)/debugfs/do_journal.c $(top_builddir)/lib/config.h \
$(srcdir)/ext3_extents.h $(srcdir)/ext2_io.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
$(srcdir)/bitops.h $(top_srcdir)/debugfs/../misc/create_inode.h \
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/debugfs/../misc/nls-enable.h \
$(top_srcdir)/lib/quota/quotaio.h $(top_srcdir)/lib/quota/dqblk_v2.h \
$(top_srcdir)/lib/quota/quotaio_tree.h $(top_srcdir)/lib/../e2fsck/dict.h \
$(srcdir)/../../e2fsck/jfs_user.h $(srcdir)/kernel-jbd.h \
$(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h
$(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/quota/quotaio.h \
$(top_srcdir)/lib/quota/dqblk_v2.h $(top_srcdir)/lib/quota/quotaio_tree.h \
$(top_srcdir)/lib/../e2fsck/dict.h $(srcdir)/../../e2fsck/jfs_user.h \
$(srcdir)/kernel-jbd.h $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h
plausible.o: $(top_srcdir)/misc/plausible.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/misc/plausible.h \
$(srcdir)/ext2fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \
$(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
$(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
$(srcdir)/ext2_ext_attr.h $(srcdir)/bitops.h $(top_srcdir)/misc/nls-enable.h

View File

@ -49,9 +49,9 @@ CHATTR_OBJS= chattr.o
LSATTR_OBJS= lsattr.o
UUIDGEN_OBJS= uuidgen.o
UUIDD_OBJS= uuidd.o
DUMPE2FS_OBJS= dumpe2fs.o
DUMPE2FS_OBJS= dumpe2fs.o plausible.o
BADBLOCKS_OBJS= badblocks.o
E2IMAGE_OBJS= e2image.o
E2IMAGE_OBJS= e2image.o plausible.o
FSCK_OBJS= fsck.o base_device.o ismounted.o
BLKID_OBJS= blkid.o
FILEFRAG_OBJS= filefrag.o
@ -71,9 +71,9 @@ PROFILED_CHATTR_OBJS= profiled/chattr.o
PROFILED_LSATTR_OBJS= profiled/lsattr.o
PROFILED_UUIDGEN_OBJS= profiled/uuidgen.o
PROFILED_UUIDD_OBJS= profiled/uuidd.o
PROFILED_DUMPE2FS_OBJS= profiled/dumpe2fs.o
PROFILED_DUMPE2FS_OBJS= profiled/dumpe2fs.o profiled/plausible.o
PROFILED_BADBLOCKS_OBJS= profiled/badblocks.o
PROFILED_E2IMAGE_OBJS= profiled/e2image.o
PROFILED_E2IMAGE_OBJS= profiled/e2image.o profiled/plausible.o
PROFILED_FSCK_OBJS= profiled/fsck.o profiled/base_device.o \
profiled/ismounted.o
PROFILED_BLKID_OBJS= profiled/blkid.o
@ -166,13 +166,14 @@ tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBBLKID) \
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o tune2fs $(TUNE2FS_OBJS) $(LIBS) \
$(LIBBLKID) $(LIBUUID) $(LIBQUOTA) $(LIBEXT2FS) $(LIBS_E2P) \
$(LIBINTL) $(SYSLIBS)
$(LIBINTL) $(SYSLIBS) $(LIBBLKID)
tune2fs.static: $(TUNE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_LIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(LDFLAGS_STATIC) -o tune2fs.static $(TUNE2FS_OBJS) \
$(STATIC_LIBS) $(STATIC_LIBBLKID) $(STATIC_LIBUUID) \
$(STATIC_LIBQUOTA) $(STATIC_LIBE2P) $(LIBINTL) $(SYSLIBS)
$(STATIC_LIBQUOTA) $(STATIC_LIBE2P) $(LIBINTL) $(SYSLIBS) \
$(STATIC_LIBBLKID)
tune2fs.profiled: $(TUNE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(PROFILED_E2P) $(DEPPROFILED_LIBBLKID) $(DEPPROFILED_LIBUUID) \
@ -181,7 +182,7 @@ tune2fs.profiled: $(TUNE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o tune2fs.profiled \
$(PROFILED_TUNE2FS_OBJS) $(PROFILED_LIBBLKID) \
$(PROFILED_LIBUUID) $(PROFILED_LIBQUOTA) $(PROFILED_LIBE2P) \
$(LIBINTL) $(PROFILED_LIBS) $(SYSLIBS)
$(LIBINTL) $(PROFILED_LIBS) $(SYSLIBS) $(PROFILED_LIBBLKID)
blkid: $(BLKID_OBJS) $(DEPLIBBLKID) $(LIBEXT2FS)
$(E) " LD $@"
@ -199,15 +200,16 @@ blkid.profiled: $(BLKID_OBJS) $(DEPPROFILED_LIBBLKID) \
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o blkid.profiled $(PROFILED_BLKID_OBJS) \
$(PROFILED_LIBBLKID) $(LIBINTL) $(PROFILED_LIBEXT2FS) $(SYSLIBS)
e2image: $(E2IMAGE_OBJS) $(DEPLIBS)
e2image: $(E2IMAGE_OBJS) $(DEPLIBS) $(DEPLIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o e2image $(E2IMAGE_OBJS) $(LIBS) \
$(LIBINTL) $(SYSLIBS)
$(LIBINTL) $(SYSLIBS) $(LIBBLKID)
e2image.profiled: $(E2IMAGE_OBJS) $(PROFILED_DEPLIBS)
e2image.profiled: $(E2IMAGE_OBJS) $(PROFILED_DEPLIBS) $(DEPLIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o e2image.profiled \
$(PROFILED_E2IMAGE_OBJS) $(PROFILED_LIBS) $(LIBINTL) $(SYSLIBS)
$(PROFILED_E2IMAGE_OBJS) $(PROFILED_LIBS) $(LIBINTL) $(SYSLIBS) \
$(LIBBLKID)
e2undo: $(E2UNDO_OBJS) $(DEPLIBS)
$(E) " LD $@"
@ -297,17 +299,18 @@ uuidd.profiled: $(UUIDD_OBJS) $(PROFILED_DEPLIBUUID)
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o uuidd.profiled $(PROFILED_UUIDD_OBJS) \
$(PROFILED_LIBUUID) $(LIBINTL) $(SYSLIBS)
dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBUUID)
dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBUUID) $(DEPLIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS) \
$(LIBS_E2P) $(LIBUUID) $(LIBINTL) $(SYSLIBS)
$(LIBS_E2P) $(LIBUUID) $(LIBINTL) $(SYSLIBS) $(LIBBLKID)
dumpe2fs.profiled: $(DUMPE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(PROFILED_LIBE2P) $(PROFILED_DEPLIBUUID)
$(PROFILED_LIBE2P) $(PROFILED_DEPLIBUUID) $(PROFILED_DEPLIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o dumpe2fs.profiled \
$(PROFILED_DUMPE2FS_OBJS) $(PROFILED_LIBS) \
$(PROFILED_LIBE2P) $(PROFILED_LIBUUID) $(LIBINTL) $(SYSLIBS)
$(PROFILED_LIBE2P) $(PROFILED_LIBUUID) $(LIBINTL) $(SYSLIBS) \
$(PROFILED_LIBBLKID)
fsck: $(FSCK_OBJS) $(DEPLIBBLKID)
$(E) " LD $@"
@ -689,7 +692,7 @@ dumpe2fs.o: $(srcdir)/dumpe2fs.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/e2p/e2p.h $(srcdir)/jfs_user.h \
$(top_srcdir)/lib/ext2fs/kernel-jbd.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
$(top_srcdir)/lib/ext2fs/kernel-list.h $(top_srcdir)/version.h \
$(srcdir)/nls-enable.h
$(srcdir)/nls-enable.h $(srcdir)/plausible.h
badblocks.o: $(srcdir)/badblocks.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/ext2fs/ext2_io.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \

View File

@ -42,6 +42,7 @@ extern int optind;
#include "../version.h"
#include "nls-enable.h"
#include "plausible.h"
#define in_use(m, x) (ext2fs_test_bit ((x), (m)))
@ -691,6 +692,8 @@ try_open_again:
com_err (program_name, retval, _("while trying to open %s"),
device_name);
printf("%s", _("Couldn't find valid filesystem superblock.\n"));
if (retval == EXT2_ET_BAD_MAGIC)
check_plausibility(device_name, CHECK_FS_EXIST, NULL);
exit (1);
}
fs->default_bitmap_type = EXT2FS_BMAP64_RBTREE;

View File

@ -47,6 +47,7 @@ extern int optind;
#include "../version.h"
#include "nls-enable.h"
#include "plausible.h"
#define QCOW_OFLAG_COPIED (1LL << 63)
#define NO_BLK ((blk64_t) -1)
@ -1578,6 +1579,8 @@ int main (int argc, char ** argv)
com_err (program_name, retval, _("while trying to open %s"),
device_name);
fputs(_("Couldn't find valid filesystem superblock.\n"), stdout);
if (retval == EXT2_ET_BAD_MAGIC)
check_plausibility(device_name, CHECK_FS_EXIST, NULL);
exit(1);
}

View File

@ -2575,6 +2575,8 @@ retry_open:
fprintf(stderr,
_("MMP block magic is bad. Try to fix it by "
"running:\n'e2fsck -f %s'\n"), device_name);
else if (retval == EXT2_ET_BAD_MAGIC)
check_plausibility(device_name, CHECK_FS_EXIST, NULL);
else if (retval != EXT2_ET_MMP_FAILED)
fprintf(stderr, "%s",
_("Couldn't find valid filesystem superblock.\n"));

25
tests/f_detect_xfs/expect Normal file
View File

@ -0,0 +1,25 @@
*** e2fsck
ext2fs_open2: Bad magic number in super-block
../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
../e2fsck/e2fsck: Bad magic number in super-block while trying to open test.img
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
test.img contains a xfs file system labelled 'test_filsys'
*** debugfs
test.img: Bad magic number in super-block while opening filesystem
test.img contains a xfs file system labelled 'test_filsys'
*** tune2fs
../misc/tune2fs: Bad magic number in super-block while trying to open test.img
test.img contains a xfs file system labelled 'test_filsys'
*** mke2fs
Creating filesystem with 16384 1k blocks and 4096 inodes
Superblock backups stored on blocks:
8193

View File

@ -0,0 +1,23 @@
*** e2fsck
ext2fs_open2: Bad magic number in super-block
../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
../e2fsck/e2fsck: Bad magic number in super-block while trying to open test.img
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
test.img contains a xfs file system labelled 'test_filsys'
*** debugfs
*** tune2fs
../misc/tune2fs: Bad magic number in super-block while trying to open test.img
test.img contains a xfs file system labelled 'test_filsys'
*** mke2fs
Creating filesystem with 16384 1k blocks and 4096 inodes
Superblock backups stored on blocks:
8193

Binary file not shown.

1
tests/f_detect_xfs/name Normal file
View File

@ -0,0 +1 @@
detect xfs filesystem

36
tests/f_detect_xfs/script Normal file
View File

@ -0,0 +1,36 @@
#!/bin/bash
FSCK_OPT=-fn
IMAGE=$test_dir/image.bz2
bzip2 -d < $IMAGE > $TMPFILE
# Run fsck to fix things?
if [ -x $DEBUGFS_EXE ]; then
EXP=$test_dir/expect
else
EXP=$test_dir/expect.nodebugfs
fi
OUT=$test_name.log
rm -rf $test_name.failed $test_name.ok
echo "*** e2fsck" > $OUT
$FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1
echo "*** debugfs" >> $OUT
test -x $DEBUGFS_EXE && $DEBUGFS_EXE -R 'quit' $TMPFILE >> $OUT 2>&1
echo "*** tune2fs" >> $OUT
$TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1
echo "*** mke2fs" >> $OUT
$MKE2FS -n $TMPFILE >> $OUT 2>&1
sed -f $cmd_dir/filter.sed -e "s|$TMPFILE|test.img|g" -i $OUT
# Figure out what happened
if cmp -s $EXP $OUT; then
echo "$test_name: $test_description: ok"
touch $test_name.ok
else
echo "$test_name: $test_description: failed"
diff -u $EXP $OUT >> $test_name.failed
fi
unset EXP OUT FSCK_OPT IMAGE