to match
.IR filespec .
.TP
-.B dump_mmp
-Display the multiple-mount protection (mmp) field values.
+.BI dump_mmp " [mmp_block]"
+Display the multiple-mount protection (mmp) field values. If
+.I mmp_block
+is specified then verify and dump the MMP values from the given block
+number, otherwise use the
+.B s_mmp_block
+field in the superblock to locate and use the existing MMP block.
.TP
.BI dx_hash " [-h hash_alg] [-s hash_seed] filename"
Calculate the directory hash of
void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
{
struct mmp_struct *mmp_s;
+ unsigned long long mmp_block;
time_t t;
errcode_t retval = 0;
if (check_fs_open(argv[0]))
return;
+ if (argc > 1) {
+ char *end = NULL;
+ mmp_block = strtoull(argv[1], &end, 0);
+ if (end == argv[0] || mmp_block == 0) {
+ fprintf(stderr, "%s: invalid MMP block '%s' given\n",
+ argv[0], argv[1]);
+ return;
+ }
+ } else {
+ mmp_block = current_fs->super->s_mmp_block;
+ }
+
+ if (mmp_block == 0) {
+ fprintf(stderr, "%s: MMP: not active on this filesystem.\n",
+ argv[0]);
+ return;
+ }
+
if (current_fs->mmp_buf == NULL) {
retval = ext2fs_get_mem(current_fs->blocksize,
¤t_fs->mmp_buf);
mmp_s = current_fs->mmp_buf;
- retval = ext2fs_mmp_read(current_fs, current_fs->super->s_mmp_block,
- current_fs->mmp_buf);
+ retval = ext2fs_mmp_read(current_fs, mmp_block, current_fs->mmp_buf);
if (retval) {
- com_err(argv[0], retval, "reading MMP block.\n");
+ com_err(argv[0], retval, "reading MMP block %llu.\n",
+ mmp_block);
return;
}