aboutsummaryrefslogtreecommitdiffstats
path: root/libinstaller
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-15 16:24:57 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-15 16:24:57 -0700
commitcbc69de20a19cbac90372fd7cbdaac00d1bbfa11 (patch)
tree47b5cd1a776b91001f991408696e74d212079b86 /libinstaller
parent27efee0ac5a62dddbe1895bc682d52da6bdfc724 (diff)
downloadsyslinux-cbc69de20a19cbac90372fd7cbdaac00d1bbfa11.tar.gz
syslinux-cbc69de20a19cbac90372fd7cbdaac00d1bbfa11.tar.xz
syslinux-cbc69de20a19cbac90372fd7cbdaac00d1bbfa11.zip
syslinux: synchronize generate_extents() with extlinux
Synchronize the code for generate_extents() from extlinux to syslinux. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'libinstaller')
-rw-r--r--libinstaller/syslxmod.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c
index c9eddec1..6df753f6 100644
--- a/libinstaller/syslxmod.c
+++ b/libinstaller/syslxmod.c
@@ -244,46 +244,45 @@ static __noinline void set_64_sl(uint64_t * p, uint64_t v)
* Generate sector extents
*/
static void generate_extents(struct syslinux_extent *ex, int nptrs,
- const sector_t *sectp, int nsect)
+ sector_t *sectp, int nsect)
{
- struct syslinux_extent thisex;
uint32_t addr = 0x7c00 + 2*SECTOR_SIZE;
uint32_t base;
- sector_t sect;
+ sector_t sect, lba;
+ unsigned int len;
- thisex.len = base = 0;
+ len = lba = base = 0;
memset(ex, 0, nptrs * sizeof *ex);
while (nsect) {
sect = *sectp++;
- if (thisex.len &&
- sect == thisex.lba + thisex.len &&
- ((addr ^ (base + thisex.len * SECTOR_SIZE)) & 0xffff0000) == 0) {
+ if (len && sect == lba + len &&
+ ((addr ^ (base + len * SECTOR_SIZE)) & 0xffff0000) == 0) {
/* We can add to the current extent */
- thisex.len++;
+ len++;
goto next;
}
- if (thisex.len) {
- set_64_sl(&ex->lba, thisex.lba);
- set_16_sl(&ex->len, thisex.len);
+ if (len) {
+ set_64_sl(&ex->lba, lba);
+ set_16_sl(&ex->len, len);
ex++;
}
base = addr;
- thisex.lba = sect;
- thisex.len = 1;
+ lba = sect;
+ len = 1;
next:
addr += SECTOR_SIZE;
nsect--;
}
- if (thisex.len) {
- set_64_sl(&ex->lba, thisex.lba);
- set_16_sl(&ex->len, thisex.len);
+ if (len) {
+ set_64_sl(&ex->lba, lba);
+ set_16_sl(&ex->len, len);
ex++;
}
}