PATH: use a linked list internallysyslinux-5.11-pre1
commit19455794d144c2c38f483890e0d384bc43b5fd63
authorMatt Fleming <matt.fleming@intel.com>
Thu, 13 Jun 2013 10:46:40 +0000 (13 11:46 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Thu, 13 Jun 2013 10:51:03 +0000 (13 11:51 +0100)
treea6929fba7955d1ac5455aca1328d0963d06c84e9
parentec1f4593622bef1b0bf9fdc95f55c520751240bd
PATH: use a linked list internally

In retrospect, choosing the colon character as the entry separator for
the PATH directive was not a smart move, as that character is also used
in TFTP-style paths. This conflict manifests as PXELINUX being unable to
find and load files.

An example dnsmasq log looks like,

dnsmasq-tftp: sent /arch/boot/syslinux/lpxelinux.0 to 192.168.0.90
dnsmasq-tftp: file /arch/ldlinux.c32 not found
dnsmasq-tftp: file /arch//ldlinux.c32 not found
dnsmasq-tftp: file /arch//boot/isolinux/ldlinux.c32 not found
dnsmasq-tftp: file /arch//isolinux/ldlinux.c32 not found
dnsmasq-tftp: file /arch//boot/syslinuxldlinux.c32 not found
dnsmasq-tftp: sent /arch//boot/syslinux/ldlinux.c32 to 192.168.0.90
dnsmasq-tftp: error 0 No error, file close received from 192.168.0.90
dnsmasq-tftp: failed sending /arch//boot/syslinux/ldlinux.c32 to 192.168.0.90
dnsmasq-tftp: sent /arch/boot/syslinux/archiso.cfg to 192.168.0.90
dnsmasq-tftp: sent /arch/boot/syslinux/whichsys.c32 to 192.168.0.90
dnsmasq-tftp: file /arch/libcom32.c32 not found
dnsmasq-tftp: file /arch//libcom32.c32 not found
dnsmasq-tftp: file /arch/libcom32.c32 not found
dnsmasq-tftp: file /arch//arch//boot/syslinux/libcom32.c32 not found

The last line of the log is the indication that there's a problem.
Internally, Syslinux adds the location of ldlinux.c32 to PATH by
querying the current working directory once ldlinux.c32 is successfully
loaded. Under PXELINUX that means the initial PATH string will be,

   "::/arch/boot/syslinux/"

The PATH parsing code doesn't know how to correctly parse the "::"
string and hence, the file is searched for relative to the 210 dhcp
option directory - /arch/.

Implement PATH with a linked list which *greatly* simplifies the path
code, and means we no longer have to parse strings backwards and
forwards.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
com32/elflink/ldlinux/readconfig.c
com32/lib/sys/module/common.c
core/elflink/load_env32.c
core/fs/fs.c
core/include/fs.h
core/path.c [new file with mode: 0644]