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

H. Peter Anvin hpa at zytor.com
Fri Mar 6 16:17:55 PST 2009


Gene Cumm wrote:
> On Fri, Mar 6, 2009 at 1:11 AM, H. Peter Anvin <hpa at zytor.com> wrote:
>> Gene Cumm wrote:
>>> Currently, the COMBOOT call required a '/' to recognize that you're
>>> searching for a directory.  This checks and automatically appends a
>>> '/' to the end of the pathname string (by creating another string
>>> temporarily) then making the COMBOOT call.
>>>
>> I'm concerned about doing this if we ever intend to make this work
>> properly over TFTP.
>>
> 
> I'm rethinking how I implemented things.
> 
> Define a new function searchdir4dir and then one of two ideas:
> 1) rename the existing function searchdir to something like
> searchdir4file then abstract away for a new function called searchdir
> 2) create a new function searchdir4all or searchdir4any (or along those lines).
> 

Note how this is already handled in the FAT and ext2 derivatives; they 
have effectively this.

> The new function will have a new interface that will either
> a) require a type of file when called
> b) return what type of file is found for the name and a handle that
> the caller can dispose of.
> 
> I'd lean towards 2-b as it would preserve existing code and allow a
> function that might implement a more complete stat() (eliminating the
> need to implement stat() in the functional but very resource intensive
> and wasteful way that I did; INT 21 AX=0022h for stat()?).  If I did
> this, I could more easily remove the dependency for the trailing '/'
> in the name.

The issue with TFTP is you have no idea what pathname separator is used 
on the host.  You may choose to assume it is '/', and it will work for 
most modern OSes, but it's not a requirement.

Of course, there is no standard way to get a directory listing over TFTP 
either.

	-hpa






More information about the Syslinux mailing list