platform/upstream/syslinux.git
14 years agodir.c32: allow "dir" without an argument to mean "dir ." syslinux-4.00-pre35
H. Peter Anvin [Sat, 6 Mar 2010 23:13:36 +0000 (15:13 -0800)]
dir.c32: allow "dir" without an argument to mean "dir ."

People logically expect "dir" to display the current directory.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoext2: return the correct file types from readdir()
H. Peter Anvin [Sat, 6 Mar 2010 23:07:53 +0000 (15:07 -0800)]
ext2: return the correct file types from readdir()

Return the global file types, not the ext2-specific ones.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agodir.c32: sort, columize and page the output
H. Peter Anvin [Sat, 6 Mar 2010 22:52:35 +0000 (14:52 -0800)]
dir.c32: sort, columize and page the output

Make the output of dir.c32 actually usable for an average user.
Present the directory contents sorted in columns, and pause for every
screenful.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore/fs: clean up, fix and improve the internal readdir() interfaces
H. Peter Anvin [Sat, 6 Mar 2010 22:51:08 +0000 (14:51 -0800)]
core/fs: clean up, fix and improve the internal readdir() interfaces

- Avoid a completely unnecessary malloc/free pair by passing a pointer
  to the filesystem driver;
- Make sure d_reclen is always set correctly;
- Make sure the d_type field is set correctly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agodirent.h: types for the d_type field
H. Peter Anvin [Sat, 6 Mar 2010 22:50:20 +0000 (14:50 -0800)]
dirent.h: types for the d_type field

Add an enum for the DT_* constants for the d_type field.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agostdcon: make the screen size available
H. Peter Anvin [Sat, 6 Mar 2010 22:49:40 +0000 (14:49 -0800)]
stdcon: make the screen size available

Make the screen size available when using stdcon, not just ansicon.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoqsort: handle the case of zero entries
H. Peter Anvin [Sat, 6 Mar 2010 22:49:10 +0000 (14:49 -0800)]
qsort: handle the case of zero entries

Avoid bugs when the qsorted array is empty.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoAdd 32-bit versions of open file/close file
H. Peter Anvin [Sat, 6 Mar 2010 19:55:57 +0000 (11:55 -0800)]
Add 32-bit versions of open file/close file

Add 32-bit API calls for open file and close file.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofat: fixing filenames with multiple-of-13 names broke all others syslinux-4.00-pre34
H. Peter Anvin [Sat, 6 Mar 2010 05:02:54 +0000 (21:02 -0800)]
fat: fixing filenames with multiple-of-13 names broke all others

The fix for filenames with names that were multiples of 13 broke all
*other* filenames.  Fix both, this time...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMerge remote branch 'origin/master' into pathbased
H. Peter Anvin [Fri, 5 Mar 2010 19:28:06 +0000 (11:28 -0800)]
Merge remote branch 'origin/master' into pathbased

Resolved Conflicts:
version

14 years agoMerge remote branch 'origin/master' into pathbased syslinux-4.00-pre33
H. Peter Anvin [Fri, 5 Mar 2010 19:22:52 +0000 (11:22 -0800)]
Merge remote branch 'origin/master' into pathbased

14 years agoNEWS, version: update for 3.86 syslinux-3.86-pre1
H. Peter Anvin [Fri, 5 Mar 2010 19:19:16 +0000 (11:19 -0800)]
NEWS, version: update for 3.86

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agochain.c32: Fix chaining to MBRs
H. Peter Anvin [Fri, 5 Mar 2010 19:13:28 +0000 (11:13 -0800)]
chain.c32: Fix chaining to MBRs

The change to load the bootsector even when loading a bootstrap from a
file broke the handing of chainloading the MBR of a disk.  Fix this.

Debugging-info-by: Thomas Mieslinger <thomas.mieslinger@lundl.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoVFAT: handle filenames with are exact multiples of 13
H. Peter Anvin [Fri, 5 Mar 2010 18:58:42 +0000 (10:58 -0800)]
VFAT: handle filenames with are exact multiples of 13

Filenames in VFAT that are exact multiples of 13 are not
null-terminated; handle that particular subcase.

Reported-by: Gert Hulselmans <gerth@zytor.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agolmalloc: add <string.h> for lzalloc
H. Peter Anvin [Fri, 5 Mar 2010 18:29:11 +0000 (10:29 -0800)]
lmalloc: add <string.h> for lzalloc

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoreaddir: replace opendir/readdir/closedir API with a 32-bit API
H. Peter Anvin [Fri, 5 Mar 2010 06:54:07 +0000 (22:54 -0800)]
readdir: replace opendir/readdir/closedir API with a 32-bit API

The 16-bit API to opendir/readdir/closedir was confused, had a memory
leak, and was incompatible with Syslinux 3.x anyway.  Replace it with
a pure 32-bit API.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoextlinux: centralize file flags setting; add FAT support syslinux-4.00-pre32
H. Peter Anvin [Fri, 5 Mar 2010 00:54:10 +0000 (16:54 -0800)]
extlinux: centralize file flags setting; add FAT support

Centralize the poking at file flags.
Add FAT support to file flags setting (S bit).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoextlinux: don't report failure after writing a FAT superblock
H. Peter Anvin [Fri, 5 Mar 2010 00:37:49 +0000 (16:37 -0800)]
extlinux: don't report failure after writing a FAT superblock

Missing parens made us return failure after successfully writing a FAT
superblock.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofat: fix longname matching
H. Peter Anvin [Fri, 5 Mar 2010 00:36:32 +0000 (16:36 -0800)]
fat: fix longname matching

Fix longname matching, which was broken due to missing counter
decrement.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agobtrfs: remove global fs ptr and clean up code
Alek Du [Wed, 3 Mar 2010 07:55:15 +0000 (15:55 +0800)]
btrfs: remove global fs ptr and clean up code

Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agobtrfs: get rid of unnecessary _fs variable
H. Peter Anvin [Wed, 3 Mar 2010 03:11:45 +0000 (19:11 -0800)]
btrfs: get rid of unnecessary _fs variable

Get rid of the unnecessary _fs variable in btrfs_fs_init().  The
compiler would have optimized it out anyway, but it's cleaner if it's
in the source.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agobtrfs: Implement next_extent and call generic_getfssec
Alek Du [Tue, 2 Mar 2010 06:35:22 +0000 (14:35 +0800)]
btrfs: Implement next_extent and call generic_getfssec

Now multiple extent allocation is supported.
Also fixed the symlink file handling and fs_init typo.

Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxe: don't allow URL parsing to produce zero bytes; retune
H. Peter Anvin [Mon, 1 Mar 2010 17:01:27 +0000 (09:01 -0800)]
pxe: don't allow URL parsing to produce zero bytes; retune

Don't allow URL escapes to produce zero bytes (%00).  Also, assume
TFTP URLs are going to be less common than "plain" filenames, so defer
the type testing until we know it's a URL.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoAdd simplified toupper, tolower, str[n]casecmp to core
H. Peter Anvin [Mon, 1 Mar 2010 16:54:36 +0000 (08:54 -0800)]
Add simplified toupper, tolower, str[n]casecmp to core

(Missing from previous checkin)

Add simplified toupper(), tolower() and str[n]casecmp()
implementations to the core, good enough for ASCII e.g. for use in URL
parsing, or in config file decoding.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxe: handle tftp:// URLs natively
H. Peter Anvin [Mon, 1 Mar 2010 07:08:52 +0000 (23:08 -0800)]
pxe: handle tftp:// URLs natively

Handle tftp:// URLs natively, instead of relying on gPXE.  This also
allows for specifying a nonstandard TFTP port.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxe: add a single-tick timeout for PXE stacks which eat transmits
H. Peter Anvin [Mon, 1 Mar 2010 06:15:45 +0000 (22:15 -0800)]
pxe: add a single-tick timeout for PXE stacks which eat transmits

Add a single-tick first-round timeout for PXE stacks which eat the
first transmit under certain circumstances, i.e. gPXE if the ARP table
isn't populated yet.

TODO: encapsulate all send packet/wait for reply code into a common
function.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agogfxboot: remove 16-bit gfxboot module
H. Peter Anvin [Mon, 1 Mar 2010 06:09:23 +0000 (22:09 -0800)]
gfxboot: remove 16-bit gfxboot module

Get rid of the 16-bit gfxboot module; use gfxboot.c32 instead.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs: add no_next_extent() dummy function
H. Peter Anvin [Mon, 1 Mar 2010 05:55:59 +0000 (21:55 -0800)]
fs: add no_next_extent() dummy function

Add a no_next_extent() dummy function for filesystems (like iso9660)
which should never end up calling next_extent (because there is only
one extent...)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: fs: get rid of the prev_extent member
H. Peter Anvin [Mon, 1 Mar 2010 05:50:04 +0000 (21:50 -0800)]
core: fs: get rid of the prev_extent member

The prev_extent member was only ever used transiently; instead pass
the new lstart in as an argument and leave the previous value of
next_extent unmolested and thus can be used in-place.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: get rid of unmangle_name completely syslinux-4.00-pre31
H. Peter Anvin [Mon, 1 Mar 2010 05:12:46 +0000 (21:12 -0800)]
core: get rid of unmangle_name completely

The notion of "mangle name" is now restricted to producing a canonical
representation, e.g. changing \ -> / for FAT filesystems.  However,
the resulting mangled name is now always human-readable, so there
never is any reason to unmangle a name.

Get rid of not just the mangling, but of the resulting unmangled-name
buffers and so on.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: remove unmangle_name
H. Peter Anvin [Mon, 1 Mar 2010 05:04:50 +0000 (21:04 -0800)]
core: remove unmangle_name

Remove the now-obsolete unmangle_name method.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: add missing dependencies
H. Peter Anvin [Mon, 1 Mar 2010 05:04:16 +0000 (21:04 -0800)]
core: add missing dependencies

We need to account for dependences as far down as we care about.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxe: change debugging message to dprintf()
H. Peter Anvin [Mon, 1 Mar 2010 04:58:38 +0000 (20:58 -0800)]
pxe: change debugging message to dprintf()

Marking debug messages is what dprintf() is for...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agomemdisk: drop DEBUG from unzip.c
H. Peter Anvin [Mon, 1 Mar 2010 03:30:42 +0000 (19:30 -0800)]
memdisk: drop DEBUG from unzip.c

DEBUG doesn't work in unzip.c/inflate.c, so always #undef it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxe: drop UDP close from unload sequence
H. Peter Anvin [Mon, 1 Mar 2010 03:29:48 +0000 (19:29 -0800)]
pxe: drop UDP close from unload sequence

UDP close is part of the reset sequence, not the unload sequence.  Now
we always execute the reset sequence, so drop it from the unload
sequence.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: don't use "const volatile" in __jiffies definition
H. Peter Anvin [Mon, 1 Mar 2010 03:28:54 +0000 (19:28 -0800)]
core: don't use "const volatile" in __jiffies definition

It looks like some versions of gcc might have issues with "const
volatile".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxe: revamp timeout, improve the unloading of gpxelinux
H. Peter Anvin [Mon, 1 Mar 2010 03:00:17 +0000 (19:00 -0800)]
pxe: revamp timeout, improve the unloading of gpxelinux

Revamp the timeout mechanism, to deal with UDP stacks (like gPXE!)
which lose transmit packets.  gPXE, in particular, will drop a UDP
packet if it doesn't have the recipient in the ARP cache.
Furthermore, it has the poor taste to not even send back an error.

Also, always unload gPXE when present, before exiting.  This should
let us clean up low memory better.  Reconsider if this turns out to be
too slow.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agodprintf: make usable on hardware
H. Peter Anvin [Mon, 1 Mar 2010 02:53:47 +0000 (18:53 -0800)]
dprintf: make usable on hardware

Actually configure the serial port used for dprintf, so we can
actually use it on real hardware.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocom32/lib: remove unused definitions
H. Peter Anvin [Mon, 1 Mar 2010 02:53:08 +0000 (18:53 -0800)]
com32/lib: remove unused definitions

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMCONFIG.embedded: make sure to honor options in MCONFIG.local
H. Peter Anvin [Mon, 1 Mar 2010 02:52:14 +0000 (18:52 -0800)]
MCONFIG.embedded: make sure to honor options in MCONFIG.local

In particular, make sure we can honor debug options in MCONFIG.local.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxelinux: allow "localboot -1" to do INT 18h, just like !pxelinux
H. Peter Anvin [Sun, 28 Feb 2010 23:14:45 +0000 (15:14 -0800)]
pxelinux: allow "localboot -1" to do INT 18h, just like !pxelinux

Allow "localboot -1" to invoke INT 18h, as it does on other
derivatives.  Perhaps that can help track down systems on which the
normal return path just isn't working.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMCONFIG: include MCONFIG.local if one exists
H. Peter Anvin [Sun, 28 Feb 2010 02:57:07 +0000 (18:57 -0800)]
MCONFIG: include MCONFIG.local if one exists

Allow for an MCONFIG.local as a handier way to set things like debug
options.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: drop accidental checkin of -DDEBUG=1 syslinux-4.00-pre30
H. Peter Anvin [Sun, 28 Feb 2010 02:48:37 +0000 (18:48 -0800)]
core: drop accidental checkin of -DDEBUG=1

We should not be compiling with -DDEBUG=1 by default!

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: fix and simplify generic_getfssec() syslinux-4.00-pre29
H. Peter Anvin [Sat, 27 Feb 2010 04:40:21 +0000 (20:40 -0800)]
core: fix and simplify generic_getfssec()

Both simplify and fix generic_getfssec().  The previous version would
occasionally request the same extent twice from the underlying layer.
This is not a big deal for ext2fs for example, but is *very* expensive
on FAT, where any out-of-order next_extent() call means walking the
FAT from the beginning.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoext2: use generic_getfssec syslinux-4.00-pre28
H. Peter Anvin [Sat, 27 Feb 2010 02:15:55 +0000 (18:15 -0800)]
ext2: use generic_getfssec

Use generic_getfssec for ext2.

NOTE: Something seems wrong with the generic_getfssec() loop; running
this on an ext2 filesystem ends up with the code looking up the same
extent twice in a row, which should not happen.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofat: use generic_getfssec(), fix generic_getfssec(), add dprintf
H. Peter Anvin [Sat, 27 Feb 2010 01:15:35 +0000 (17:15 -0800)]
fat: use generic_getfssec(), fix generic_getfssec(), add dprintf

Use generic_getfssec() for the FAT filesystem.  Do a bunch of
calculations based on clusters rather than on sectors, so we don't
have to do the same thing N times for N sectors per cluster.

Fix boundary conditions in generic_getfssec().  Adjust iso9660 to
match the resulting interface change.

Add dprintf's to generic_getfssec() and a few other routines.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoiso9660: use boot_info_table and fix hybrid mode
H. Peter Anvin [Fri, 26 Feb 2010 21:18:26 +0000 (13:18 -0800)]
iso9660: use boot_info_table and fix hybrid mode

In hybrid disk mode, one block will generally *not* equal one sector.
Use the boot_info_table to find the primary volume descriptor.
Remove the now-unused cdrom_read_blocks().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoiso9660: use generic_getfssec()
H. Peter Anvin [Fri, 26 Feb 2010 20:12:12 +0000 (12:12 -0800)]
iso9660: use generic_getfssec()

Use generic_getfssec() for iso9660.  This is a particularly simple
case, since all iso9660 files (that we support) are contiguous.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs: add generic getfssec
H. Peter Anvin [Fri, 26 Feb 2010 20:11:18 +0000 (12:11 -0800)]
fs: add generic getfssec

Add a generic getfssec method which operate on cached extents. This
should avoid the need to each filesystem to implement its own getfssec
loop.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore/readdir.c: remove unused variable
H. Peter Anvin [Fri, 26 Feb 2010 20:10:29 +0000 (12:10 -0800)]
core/readdir.c: remove unused variable

Remove an unused variable in opendir().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs/iso9660: remove unused variables
H. Peter Anvin [Fri, 26 Feb 2010 19:43:44 +0000 (11:43 -0800)]
fs/iso9660: remove unused variables

Remove variables which are no longer used.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agodos: make sure we don't look like a Windows image
H. Peter Anvin [Fri, 26 Feb 2010 18:16:48 +0000 (10:16 -0800)]
dos: make sure we don't look like a Windows image

Some tools might assume that the reloc offset being 64 automatically
means it's really a Windows file.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agodoc: document 32-bit-only API calls
H. Peter Anvin [Thu, 25 Feb 2010 06:20:19 +0000 (22:20 -0800)]
doc: document 32-bit-only API calls

As long as we have a pretence of an ABI we should at least keep it
updated.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoopendir: remove unnecessary buffer pointer
H. Peter Anvin [Thu, 25 Feb 2010 06:16:24 +0000 (22:16 -0800)]
opendir: remove unnecessary buffer pointer

We don't need to abuse the InitRD buffer anymore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoiso9660: make readdir() work syslinux-4.00-pre27
H. Peter Anvin [Thu, 25 Feb 2010 05:42:08 +0000 (21:42 -0800)]
iso9660: make readdir() work

Make readdir work on iso9660.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoopendir: use internal protected-mode interfaces
H. Peter Anvin [Thu, 25 Feb 2010 05:31:02 +0000 (21:31 -0800)]
opendir: use internal protected-mode interfaces

No need to do yet another bounce through lowmem for no good reason.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs: searchdir: handle opening a directory
H. Peter Anvin [Thu, 25 Feb 2010 05:29:33 +0000 (21:29 -0800)]
fs: searchdir: handle opening a directory

Handle the case of opening a directory.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs: cleanups: use PVT() macro for all filesystems; iso9660 cleanups
H. Peter Anvin [Thu, 25 Feb 2010 05:04:29 +0000 (21:04 -0800)]
fs: cleanups: use PVT() macro for all filesystems; iso9660 cleanups

Use a PVT() macro and a structure to access the private inode data for
all filesystems, instead of open-coding the type.

Use a packed structure for iso9660, instead of open-coding pointer
casts.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoisolinux: 7C00h -> TEXT_START
H. Peter Anvin [Thu, 25 Feb 2010 02:38:17 +0000 (18:38 -0800)]
isolinux: 7C00h -> TEXT_START

Use the TEXT_START macro instead of hard-coding 7C00h.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoisolinux: drop dependency on core_xfer_buf in self-loader syslinux-4.00-pre26
H. Peter Anvin [Thu, 25 Feb 2010 02:27:29 +0000 (18:27 -0800)]
isolinux: drop dependency on core_xfer_buf in self-loader

Drop the dependency on core_xfer_buf in the self-loader, and instead
load the data aligned to an offset, and then bulk-move it into place.
diskstart.inc will need to do something similar if/when support is
added for > 1K sectors on BIOS.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore/mem: better dprintf()
H. Peter Anvin [Thu, 25 Feb 2010 02:25:58 +0000 (18:25 -0800)]
core/mem: better dprintf()

Add a few dprintf() statements to the core malloc/free which makes it
easier to track down bugs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: fix double free of pathbuf, constify iget filename, fix iso9660
H. Peter Anvin [Thu, 25 Feb 2010 02:24:14 +0000 (18:24 -0800)]
core: fix double free of pathbuf, constify iget filename, fix iso9660

Fix double free of pathbuf in searchdir().
Constify the pathname passed to ->iget().
Major cleanups of the iso9660 filesystem; it would use insufficiently
dimensioned stack variables and do compares in a rather inefficient
manner.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocom32: replace hard-coded bounce buffer use in com32/lib syslinux-4.00-pre25
H. Peter Anvin [Wed, 24 Feb 2010 22:18:49 +0000 (14:18 -0800)]
com32: replace hard-coded bounce buffer use in com32/lib

Replace hard-coded bounce buffer uses in com32/lib with lmalloc/lfree.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: fix lowmem malloc
H. Peter Anvin [Wed, 24 Feb 2010 22:16:15 +0000 (14:16 -0800)]
core: fix lowmem malloc

a) initialize *all* the head nodes
b) the lowmem heap needs to be paragraph (16 byte) aligned
c) use a dedicated tag value for headnodes.  The type code should be
   removed and replaced with special tag values for head node and
   free.
d) for libcom32 code called from the core, do NOT present a
   usable bounce buffer; we should only ever use lmalloc/lfree.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocom32: add lzalloc()
H. Peter Anvin [Wed, 24 Feb 2010 20:01:59 +0000 (12:01 -0800)]
com32: add lzalloc()

Add lzalloc().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agolmalloc: set errno on failure
H. Peter Anvin [Wed, 24 Feb 2010 19:58:42 +0000 (11:58 -0800)]
lmalloc: set errno on failure

The core function can't set the com32 errno, so we need to do it in
the wrapper.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocom32: wrapper functions for lowmem allocations
H. Peter Anvin [Wed, 24 Feb 2010 19:56:43 +0000 (11:56 -0800)]
com32: wrapper functions for lowmem allocations

lmalloc(), lfree(), lstrdup()

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: move aligned segments earlier
H. Peter Anvin [Wed, 24 Feb 2010 19:14:04 +0000 (11:14 -0800)]
core: move aligned segments earlier

Move the aligned segments downward, to provide for the largest
possible contiguous lowmem heap.  This minimizes the necessary lowmem
footprint.  (Note: the heap doesn't actually need to be contiguous,
but having it not be makes it harder to size.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: use better malloc; add low memory malloc; fix com32 exit
H. Peter Anvin [Wed, 24 Feb 2010 06:32:32 +0000 (22:32 -0800)]
core: use better malloc; add low memory malloc; fix com32 exit

Use a better malloc for the core.  In particular, use the same core
that we should eventually be able to use for the entire system in
Syslinux 5 -- with module awareness, etc.

This code can also accommodate multiple heaps.  Set up a separate heap
for lowmem; the intent is to use explicit lowmem allocations instead
of the static bounce buffer.  The lowmem allocation is also exported
via the pmapi mechanism, so modules can safely allocate lowmem.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopxe: clean up/fix generation of ipappend strings
H. Peter Anvin [Wed, 24 Feb 2010 03:35:11 +0000 (19:35 -0800)]
pxe: clean up/fix generation of ipappend strings

Clean up and fix the generation of the ipappend strings.  In
particular, BOOTIF= was generated into a buffer which was too small.
Put the buffer definitions in C while we're at it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs/pxe: drop the use of PKTBUF_SEG
H. Peter Anvin [Wed, 24 Feb 2010 03:16:34 +0000 (19:16 -0800)]
fs/pxe: drop the use of PKTBUF_SEG

Drop the use of a magic PKTBUF_SEG, and instead just have a high
memory buffer for each file, and a single lowmem buffer that we reuse
at will.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMerge branch 'pxefix' into pathbased
H. Peter Anvin [Wed, 24 Feb 2010 03:11:13 +0000 (19:11 -0800)]
Merge branch 'pxefix' into pathbased

14 years agopxe: set the block size in the fs structure
H. Peter Anvin [Wed, 24 Feb 2010 03:09:44 +0000 (19:09 -0800)]
pxe: set the block size in the fs structure

For better or worse, we use block counts for communicating with the
filesystem.  It would therefore be rather polite to tell them what
block size we expect.

This fixes a boot failure with the new loadhigh routine.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: add a direct 32-bit API
H. Peter Anvin [Wed, 24 Feb 2010 02:14:12 +0000 (18:14 -0800)]
core: add a direct 32-bit API

Add a direct 32-bit API to some functions; initially read file only.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agopathbased:btrfs use iget interface and leverage general search routing
Alek Du [Mon, 22 Feb 2010 07:09:12 +0000 (15:09 +0800)]
pathbased:btrfs use iget interface and leverage general search routing

Now btrfs won't export its own searchdir, it uses the iget and
iget_root interface.

Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore/com32.inc: warn about possible double use of core_xfer_buf
H. Peter Anvin [Mon, 22 Feb 2010 01:55:57 +0000 (17:55 -0800)]
core/com32.inc: warn about possible double use of core_xfer_buf

core_xfer_buf is still used as bounce buffer by libcom32 code linked
into the core.  This is likely unsafe -- needs to be fixed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: rewrite loadhigh in C
H. Peter Anvin [Mon, 22 Feb 2010 01:53:23 +0000 (17:53 -0800)]
core: rewrite loadhigh in C

Rewrite the loadhight function in C, and eliminate double usage of
xfer_buf_seg.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocom32: go back to using real_mode_seg as bounce buffer
H. Peter Anvin [Mon, 22 Feb 2010 00:07:54 +0000 (16:07 -0800)]
com32: go back to using real_mode_seg as bounce buffer

Go back to using real_mode_seg as bounce buffer; this reserves
xfer_buf_seg strictly for the in-core filesystem code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: let xfer_buf_seg, real_mode_seg be assigned by the linker
H. Peter Anvin [Sun, 21 Feb 2010 23:42:03 +0000 (15:42 -0800)]
core: let xfer_buf_seg, real_mode_seg be assigned by the linker

Use the linker to assign xfer_bug_seg and real_mode_seg.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMerge remote branch 'origin/master' into pathbased
H. Peter Anvin [Sun, 21 Feb 2010 06:41:34 +0000 (22:41 -0800)]
Merge remote branch 'origin/master' into pathbased

14 years agolibpci: merge BIOS read and BIOS write
H. Peter Anvin [Sun, 21 Feb 2010 06:26:39 +0000 (22:26 -0800)]
libpci: merge BIOS read and BIOS write

Save a few bytes by merging the very similar BIOS read and BIOS write
functions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoi915resolution: use libpci to access PCI config space syslinux-3.85 syslinux-3.85-pre13
H. Peter Anvin [Wed, 17 Feb 2010 04:12:57 +0000 (20:12 -0800)]
i915resolution: use libpci to access PCI config space

Use libpci to access PCI config space.  This *hopefully* will make it
less likely that some old machine hangs when failing to set the
requested video mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoNEWS: document i915resolution merge. syslinux-3.85-pre12
H. Peter Anvin [Tue, 16 Feb 2010 23:11:09 +0000 (15:11 -0800)]
NEWS: document i915resolution merge.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMerge branch 'i915res'
H. Peter Anvin [Tue, 16 Feb 2010 23:09:31 +0000 (15:09 -0800)]
Merge branch 'i915res'

14 years agocore: use vk_append for function 0016h temp storage syslinux-4.00-pre24
H. Peter Anvin [Tue, 16 Feb 2010 22:53:51 +0000 (14:53 -0800)]
core: use vk_append for function 0016h temp storage

a) we have to copy the command line tail earlier - the pm_*
   calls may use xfer_buf_seg in particular.
b) use vk_append rather than trackbuf; vk_append should definitely
   be unused.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: remove stray -DDEBUG
H. Peter Anvin [Tue, 16 Feb 2010 22:27:10 +0000 (14:27 -0800)]
core: remove stray -DDEBUG

Remove stray -DDEBUG that should not have been committed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoext2: handle symlinks larger than a single block
H. Peter Anvin [Tue, 16 Feb 2010 22:09:03 +0000 (14:09 -0800)]
ext2: handle symlinks larger than a single block

There is no law that symlinks has to be a single block only.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoext2: a zero block number is actually legit
H. Peter Anvin [Tue, 16 Feb 2010 21:57:30 +0000 (13:57 -0800)]
ext2: a zero block number is actually legit

It may not happen in normal operation, but a zero block value is legit
and means an all-zero block.  For anything which uses the cache, we
have dealt with that by always keeping a zero block in the cache.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoext2: drop any 64K limit
H. Peter Anvin [Tue, 16 Feb 2010 21:52:09 +0000 (13:52 -0800)]
ext2: drop any 64K limit

There is no point in maintaining a 64K limit; this is handled at a
lower level in the disk I/O library if appropriate.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs: move the disk cache into high memory
H. Peter Anvin [Tue, 16 Feb 2010 21:49:33 +0000 (13:49 -0800)]
fs: move the disk cache into high memory

Move the disk cache out of the DOS memory area.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoext2: fix confusion between logical and physical block numbers
H. Peter Anvin [Tue, 16 Feb 2010 21:37:42 +0000 (13:37 -0800)]
ext2: fix confusion between logical and physical block numbers

Fix a minor confusion between logical and physical block numbers in
the new iterative bmap implementation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocache: fix cache initialization
H. Peter Anvin [Tue, 16 Feb 2010 21:36:59 +0000 (13:36 -0800)]
cache: fix cache initialization

Fix the cache initialization; in particular make sure dev->cache_head
actually gets set.  Also, just use a plain division to figure out how
many entries we can fit in the cache.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs: move cache_init() into fs_init, to handle special needs
H. Peter Anvin [Tue, 16 Feb 2010 20:22:12 +0000 (12:22 -0800)]
fs: move cache_init() into fs_init, to handle special needs

Move cache_init() into the fs_init methods, to accommodate special
handling, e.g. the all-zero zero block for ext2.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoext2: fix bmap block number breakage
H. Peter Anvin [Tue, 16 Feb 2010 20:21:48 +0000 (12:21 -0800)]
ext2: fix bmap block number breakage

Fix the handling of block numbers in the bmap loop.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocache: fix _get_cache_block() return, add lock_cache_block()
H. Peter Anvin [Tue, 16 Feb 2010 20:20:36 +0000 (12:20 -0800)]
cache: fix _get_cache_block() return, add lock_cache_block()

Correct the return value from _get_cache_block(), and add a method for
locking a block permanently in the cache.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocache: update the metadata cache design
H. Peter Anvin [Tue, 16 Feb 2010 20:01:19 +0000 (12:01 -0800)]
cache: update the metadata cache design

- instead of get_cache_block() returning a descriptor, have
  get_cache() returning const void *.
- have a subfunction to allow getting a block without reading it
  from disk, and returning the cache descriptor.  This will be
  used in ext2 to pre-seed block 0 with all zero.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: move fs-related C files into fs/
H. Peter Anvin [Tue, 16 Feb 2010 18:35:34 +0000 (10:35 -0800)]
core: move fs-related C files into fs/

Move filesystem-related C files into the fs/ directory.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: remove obsolete assembly strecpy.inc
H. Peter Anvin [Tue, 16 Feb 2010 18:33:21 +0000 (10:33 -0800)]
core: remove obsolete assembly strecpy.inc

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agocore: remove obsolete assembly cache.inc
H. Peter Anvin [Tue, 16 Feb 2010 18:32:29 +0000 (10:32 -0800)]
core: remove obsolete assembly cache.inc

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agofs: use malloc'd mutable pathname buffers syslinux-4.00-pre23
H. Peter Anvin [Tue, 16 Feb 2010 17:33:28 +0000 (09:33 -0800)]
fs: use malloc'd mutable pathname buffers

Use malloc'd mutable pathname buffers during pathname walks.  This
avoids the need for very large static buffers, as well as the need to
copy character by character.  It also handles the symlink case fairly
nicely.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>