[syslinux] [PATCH 3/5] COM32: Improve opendir() to deal with no '/' at end of string

Gene Cumm gene.cumm at gmail.com
Thu Mar 12 10:44:35 PDT 2009


On Mon, Mar 9, 2009 at 2:29 PM, H. Peter Anvin <hpa at zytor.com> wrote:
> Gene Cumm wrote:
>>
>> At the moment, I'm looking though SYSLINUX and all I'm finding is
>> searchdir and search_dos_dir.  search_dos_dir searches 1 directory for
>> a particular name (regardless of file type).  Is this what you meant?
>>
>
> Yes.  There is an equivalent in EXTLINUX, and in ISOLINUX.  It's not
> formalized, because we haven't had a need for a global interface for
> this before.
>

I thought so.  It appears that all of the heavy work is already done
except it only gives out handles on regular files with non-zero size.

I was thinking that searchdir4dir would function a lot like the
current searchdir except, instead of returning a file pointer for a
regular file, it returns a file pointer for a directory.  I apologize
if what I was saying before may have been confusing and slightly
ambiguous.

search_dos_dir would remain intact exactly as it is as it does exactly
what it needs to: search a single directory for a file (directory or
regular) by name.

INT 22h AX=0006h calls searchdir.  INT 22h AX=0020h would call
searchdir4dir.  searchdir and searchdir4dir would call searchdir4any,
examine DL for the returned type, and determine the appropriate action
(free, return, etc.).  searchdir4any would parse the string in DS:DI,
one component at a time and use search_dos_dir to attempt to find it,
returning size in EAX, handle at SI, and FAT attributes in DL (for
now).

I have a patch ready that does exactly this if you would like to see.

Another possibility is to consolidate code even more and return
something resembling st_mode in DX or d_type in DL allowing the top
level functions (searchdir, searchdir4dir) to exist in shared code and
searchdir4any will be in each variant.

-Gene




More information about the Syslinux mailing list