diff options
author | Kaho Ng <ngkaho1234@gmail.com> | 2017-07-20 16:52:11 +0300 |
---|---|---|
committer | Kaho Ng <ngkaho1234@gmail.com> | 2017-07-20 19:03:49 +0300 |
commit | 785943f04b9451c9bd700c091331370a09f8d6e7 (patch) | |
tree | e8091006bb16dab42f52b148993b278bbbc3933d | |
parent | 264b9ac0e1bb97259b0af88f33f9a03d4116e663 (diff) |
Ext3Fsd: fix issue #6
Implement ro_compat/incompat flags inspection as a fix for #6.
-rw-r--r-- | Ext3Fsd/memory.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Ext3Fsd/memory.c b/Ext3Fsd/memory.c index 42c2450..ac38e28 100644 --- a/Ext3Fsd/memory.c +++ b/Ext3Fsd/memory.c @@ -2309,17 +2309,22 @@ Ext2InitializeVcb( IN PEXT2_IRP_CONTEXT IrpContext, __leave; } - /* checking in/compat features */ - if (IsFlagOn(sb->s_feature_compat, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { - Vcb->IsExt3fs = TRUE; - } - - /* don't mount any volumes with external journal devices */ - if (IsFlagOn(sb->s_feature_incompat, EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) { + /* Reject mounting volume if we encounter unsupported incompat features */ + if (FlagOn(sb->s_feature_incompat, ~EXT4_FEATURE_INCOMPAT_SUPP)) { Status = STATUS_UNRECOGNIZED_VOLUME; __leave; } + /* Mount the volume RO if we encounter unsupported ro_compat features */ + if (FlagOn(sb->s_feature_ro_compat, ~EXT4_FEATURE_RO_COMPAT_SUPP)) { + SetLongFlag(Vcb->Flags, VCB_READ_ONLY); + } + + /* Recognize the filesystem as Ext3fs if it supports journalling */ + if (IsFlagOn(sb->s_feature_compat, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { + Vcb->IsExt3fs = TRUE; + } + /* check block size */ Vcb->BlockSize = (EXT2_MIN_BLOCK_SIZE << sb->s_log_block_size); /* we cannot handle volume with block size bigger than 64k */ |