Bug 430927

Summary: RFE: file magic - detect ext4 filesystems
Product: [Fedora] Fedora Reporter: Eric Sandeen <esandeen>
Component: fileAssignee: Tomas Smetana <tsmetana>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-01 09:21:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eric Sandeen 2008-01-30 17:23:39 UTC
I have some magic file changes for ext4; I'll run them past the ext4 list and
attach a diff here.

Can you send changes upstream or should I?

Thanks,
-Eric

Comment 1 Tomas Smetana 2008-01-31 09:19:36 UTC
I can send the patch upstream.

Comment 2 Eric Sandeen 2008-01-31 18:05:11 UTC
Ok, here's a new magic section for ext2/3/4, to replace what's there.  ( I can
attach a real patch if you prefer...)

It didn't get any NAKs on the ext4 list, but maybe it'd be worth letting it sit
in rawhide for just a bit before upstream submission?

I put a few commented-out features in, to make it easy to display those things
in the future if desired.

Thanks,
-Eric

# ext2/ext3 filesystems - Andreas Dilger <adilger>
# ext4 filesystem - Eric Sandeen <sandeen>
0x438   leshort         0xEF53          Linux
>0x44c  lelong          x               rev %d
>0x43e  leshort         x               \b.%d
# No journal?  ext2
>0x45c  lelong          ^0x0000004      ext2 filesystem data
>>0x43a leshort         ^0x0000001      (mounted or unclean)
# Has a journal?  ext3 or ext4
>0x45c  lelong          &0x0000004
#  and small INCOMPAT?
>>0x460 lelong          <0x0000040
#   and small RO_COMPAT?
>>>0x464 lelong         <0x0000008      ext3 filesystem data
#   else large RO_COMPAT?
>>>0x464 lelong         >0x0000007      ext4 filesystem data
#  else large INCOMPAT?
>>0x460 lelong          >0x000003f      ext4 filesystem data
# General flags for any ext* fs
>0x460  lelong          &0x0000004      (needs journal recovery)
>0x43a  leshort         &0x0000002      (errors)
# INCOMPAT flags
>0x460  lelong          &0x0000001      (compressed)
#>0x460 lelong          &0x0000002      (filetype)
#>0x460 lelong          &0x0000010      (meta bg)
>0x460  lelong          &0x0000040      (extents)
>0x460  lelong          &0x0000080      (64bit)
#>0x460 lelong          &0x0000100      (mmp)
#>0x460 lelong          &0x0000200      (flex bg)
# RO_INCOMPAT flags
#>0x464 lelong          &0x0000001      (sparse super)
>0x464  lelong          &0x0000002      (large files)
>0x464  lelong          &0x0000008      (huge files)
#>0x464 lelong          &0x0000010      (gdt checksum)
#>0x464 lelong          &0x0000020      (many subdirs)
#>0x463 lelong          &0x0000040      (extra isize)

Comment 3 Tomas Smetana 2008-02-01 08:39:18 UTC
Thanks.  I'll put it in the rawhide.