bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug 485507] RFE: add ext4 to "stat -f" output


From: Eric Sandeen
Subject: Re: [Bug 485507] RFE: add ext4 to "stat -f" output
Date: Mon, 16 Feb 2009 11:53:10 -0600
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Jim Meyering wrote:
> Eric Sandeen <address@hidden> wrote:
>> Jim Meyering wrote:
>>> In http://bugzilla.redhat.com/485507
>>>
>>> Eric Sandeen proposed to add ext4 to the list of names
>>> currently reported for that type of file system ("ext2/ext3").
>>>
>>> I'm reluctant to change that string, because doing so might
>>> well break scripts that rely on them:
>>>
>>>     case $(stat -f --format %T .) in
>>>       ext2/ext3) ;;
>>>       *) destroy_partition ;;
>>>     esac
>>>
>>> Sure, script writers might well anticipate this and
>>> prefer to use the %t directive to get the type in hexadecimal,
>>> but that's far less readable.
>>>
>>> How much code (and how ugly) would be required to distinguish ext4
>>> from ext[23]?
>> it'd need to be able to do some parsing of the ext2/3/4 feature flags,
>> so it'd need to know some ext2/3/4 details.
>>
>> lib/blkid/probe.c in e2fsprogs is an example, see probe_ext2,
>> probe_ext3, etc.  It reads in the superblock and then checks some of the
>> feature fields, for example:
>>
>>         /* Ext4 has at least one feature which ext3 doesn't understand */
>>         if (!(blkid_le32(es->s_feature_ro_compat) &
>>               EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) &&
>>             !(blkid_le32(es->s_feature_incompat) &
>>               EXT3_FEATURE_INCOMPAT_UNSUPPORTED))
>>                 return -BLKID_ERR_PARAM;
>>
>> so it'd not be rocket science but it might be a lot more fs details than
>> you'd really want in coreutils, I'm not sure...
> 
> Would you mind writing some proof-of-concept code for that?
> If it's not too big or ugly, I'd like to teach stat -f
> to distinguish ext4 from ext2/3.

Ok, I'll put it on the TODO list.  :)

Thanks,
-Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]