aboutsummaryrefslogtreecommitdiffstats
path: root/debugfs/debugfs.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2011-11-11 21:06:04 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-11-11 21:06:04 -0500
commit7105c183a0f4622268a50db37017cfacc9877e5f (patch)
tree89935ef473c4d5d65fb8019872f2b35d20320eac /debugfs/debugfs.c
parent3859977a6b29889b7115db647d2c27c6bf1bd8be (diff)
downloadandroid_external_e2fsprogs-7105c183a0f4622268a50db37017cfacc9877e5f.tar.gz
android_external_e2fsprogs-7105c183a0f4622268a50db37017cfacc9877e5f.tar.bz2
android_external_e2fsprogs-7105c183a0f4622268a50db37017cfacc9877e5f.zip
debugfs: tidy up mmp handling
Several small fixes: * Gracefully fail mmp commands if fs is not open * Show magic number in dump_mmp command * Fix header in output for set_mmp_value -l Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'debugfs/debugfs.c')
-rw-r--r--debugfs/debugfs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index eba3b697..1fb8f448 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -2165,11 +2165,15 @@ void do_punch(int argc, char *argv[])
void do_dump_mmp(int argc, char *argv[])
{
- struct ext2_super_block *sb = current_fs->super;
+ struct ext2_super_block *sb;
struct mmp_struct *mmp_s;
time_t t;
errcode_t retval = 0;
+ if (check_fs_open(argv[0]))
+ return;
+
+ sb = current_fs->super;
if (sb->s_mmp_block <= sb->s_first_data_block ||
sb->s_mmp_block >= ext2fs_blocks_count(sb)) {
com_err(argv[0], EXT2_ET_MMP_BAD_BLOCK, "while dumping it.\n");
@@ -2203,6 +2207,7 @@ void do_dump_mmp(int argc, char *argv[])
fprintf(stdout, "time: %lld -- %s", mmp_s->mmp_time, ctime(&t));
fprintf(stdout, "node_name: %s\n", mmp_s->mmp_nodename);
fprintf(stdout, "device_name: %s\n", mmp_s->mmp_bdevname);
+ fprintf(stdout, "magic: 0x%x\n", mmp_s->mmp_magic);
}
static int source_file(const char *cmd_file, int sci_idx)