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

Jeffrey Hutzelman jhutz at cmu.edu
Sun Mar 1 06:02:04 PST 2009


--On Saturday, February 28, 2009 07:08:38 PM -0500 Gene Cumm 
<gene.cumm at gmail.com> wrote:

> I'm looking for comments on what to return from readdir in DL or DX.
> Currently, the data in DL is misaligned (patch coming soon, along with
> at least two more) but it also got me thinking about the fact that
> some filesystems, I believe, actually store st_mode directly in the
> filesystem.  I'm thinking that using DX to return st_mode may prove
> more useful in the long run than just returning d_type.
>
> Looking at com32/lib/sys/fstat.c, a regular file has an access mode of
> 0444 (Read for all).  I would think that that should probably be the
> return value for any filesystem that does not implement Unix-style
> access modes.  Additionally, the access mode of a file from a
> filesystem implementing ACMs should be examined also.  Ideas include
> OR with 0444, replace with 0444, AND with 0444 or just as is.

Since you don't have anything resembling UNIX users, there's no use for 
UNIX access modes and really very little point in emulating them, other 
than for informational purposes.  So...

If the filesystem stores a UNIX mode, it should be reported as-is.
Otherwise, report everything as either 777 or 555, depending on whether the 
file is writable or not (that is, for filesystems like FAT that have a 
"readonly" bit, report that by turning off the 222 bits.

There's no point in trying to understand more complex access lists; the 
result won't be very informative, and it'll never be used for actual access 
control, so IMHO there's not much point in faking it.

I would also note that returning the UNIX mode from readdir is not nearly 
as useful as returning filetype information.  So if you have to choose, 
return the filetype.

-- Jeff




More information about the Syslinux mailing list