Skip to content

Commit

Permalink
ext2 parser: decode revision level
Browse files Browse the repository at this point in the history
  • Loading branch information
masatake committed May 18, 2016
1 parent 6513168 commit ce52028
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hachoir/parser/file_system/ext2.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ class SuperBlock(FieldSet):
2: "Readonly",
3: "Panic",
}
revision_levels = {
0: "The good old (original) format",
1: "V2 format w/ dynamic inode sizes",
}
hash_version = {
0: "Legacy",
1: "Half MD4",
Expand Down Expand Up @@ -349,7 +353,7 @@ def createFields(self):
yield TimestampUnix32(self, "last_check", "Time of last check")
yield textHandler(UInt32(self, "check_interval", "Maximum time between checks"), self.postMaxTime)
yield Enum(UInt32(self, "creator_os", "Creator OS"), self.os_name)
yield UInt32(self, "rev_level", "Revision level")
yield Enum(UInt32(self, "rev_level", "Revision level"), self.revision_levels)
yield UInt16(self, "def_resuid", "Default uid for reserved blocks")
yield UInt16(self, "def_resgid", "Default gid for reserved blocks")
yield UInt32(self, "first_ino", "First non-reserved inode")
Expand Down
1 change: 1 addition & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def test_ext2(self):
self.checkValue(parser, "/superblock/hash_seed[3]", 847697135)
self.checkDisplay(parser, "/superblock/def_hash_version", "Tea")
self.checkValue(parser, "/group[0]/inode_table/inode[0]/flags/SECRM", False)
self.checkDisplay(parser, "/superblock/rev_level", "V2 format w/ dynamic inode sizes")

parser = self.parse("default_mount_opts.ext2")
self.checkValue(parser, "/superblock/default_mount_opts/DEBUG", False)
Expand Down

0 comments on commit ce52028

Please sign in to comment.