diff options
author | Matt Fleming <matt.fleming@intel.com> | 2013-06-13 11:46:40 +0100 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2013-06-13 11:51:03 +0100 |
commit | 19455794d144c2c38f483890e0d384bc43b5fd63 (patch) | |
tree | a6929fba7955d1ac5455aca1328d0963d06c84e9 /core/include/fs.h | |
parent | ec1f4593622bef1b0bf9fdc95f55c520751240bd (diff) | |
download | syslinux-19455794d144c2c38f483890e0d384bc43b5fd63.tar.gz |
PATH: use a linked list internallysyslinux-5.11-pre1
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>
Diffstat (limited to 'core/include/fs.h')
-rw-r--r-- | core/include/fs.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/include/fs.h b/core/include/fs.h index c7d0fd75..b5c7f0d9 100644 --- a/core/include/fs.h +++ b/core/include/fs.h @@ -1,6 +1,7 @@ #ifndef FS_H #define FS_H +#include <linux/list.h> #include <stddef.h> #include <stdbool.h> #include <string.h> @@ -182,7 +183,14 @@ static inline struct file *handle_to_file(uint16_t handle) return handle ? &files[handle-1] : NULL; } -extern char *PATH; +struct path_entry { + struct list_head list; + const char *str; +}; + +extern struct list_head PATH; + +extern struct path_entry *path_add(const char *str); /* fs.c */ void pm_mangle_name(com32sys_t *); |