[syslinux] [RFC] COMBOOT: readdir: st_mode or d_type

Gene Cumm gene.cumm at gmail.com
Tue Mar 3 18:03:36 PST 2009


On Tue, Mar 3, 2009 at 2:50 PM, Jeffrey Hutzelman <jhutz at cmu.edu> wrote:
> --On Tuesday, March 03, 2009 02:05:45 PM -0500 Gene Cumm
> <gene.cumm at gmail.com> wrote:
>> As you've said, some file systems do store a basic type
>> in the dirent but it looks like EXT2 is not one of them.
>
> EXT2 _is_ one of them, if EXT2_FEATURE_INCOMPAT_FILETYPE is set.  I don't
> know offhand how old this feature is, but I'm going to guess that it's
> pretty old at this point and present in most filesystems.

LOL, gotta love incomplete summaries.  Sounds like I need to find a
better documentation source.  Worst case: source code.

>> At the moment, the COM32 C struct dirent can hold all of this
>> information, far more than most UNIX systems.  Thinking about what
>> you've said, it may be beneficial to either remove those members or
>> insert a flag stating if they're valid.  Doing so would mean that for
>> FAT and ISO9660, the data could be in a dirent but EXT2 might require
>> a stat()/fstat() call.
>
> Yes, I think that's a good idea.  Note that d_type encodes this information
> through the use of a special value, DT_UNKNOWN, when the information is not
> available.

Yep, already saw that.  Convienently, 0.  I'm already using it (just
in case there's a weird file found).

d_type and a read-only flag (5 bits) are probably the only parts of
st_mode needed.  The remaining 8 bits from the file access mode are
probably unneeded.  The last 3 bits (S_ISUID S_ISGID S_ISVTX) are even
more unneeded.

-- 
-Gene




More information about the Syslinux mailing list