summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-06-15 16:26:43 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-06-15 16:26:43 -0700
commit545951d03e60d346b9ff35ec8c15d94f3b766878 (patch)
tree365b9665fa33cbf2ee5ab0fbf9309fb3c60d1532
parentca233d741136f51894091cb65480fe4696278fd5 (diff)
parent66f58cb7dc6818aa45974231b90424281311658f (diff)
downloadsyslinux-545951d03e60d346b9ff35ec8c15d94f3b766878.tar.gz
Merge branch 'pathbased' of ssh://terminus.zytor.com/pub/git/syslinux/syslinux into pathbasedsyslinux-4.00-pre48
-rw-r--r--extlinux/main.c4
-rw-r--r--libinstaller/syslxmod.c29
2 files changed, 15 insertions, 18 deletions
diff --git a/extlinux/main.c b/extlinux/main.c
index a4b81cdd..c3de190b 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -198,7 +198,7 @@ int get_geometry(int devfd, uint64_t totalbytes, struct hd_geometry *geo)
* Generate sector extents
*/
static void generate_extents(struct syslinux_extent *ex, int nptrs,
- sector_t *sectp, int nsect)
+ const sector_t *sectp, int nsect)
{
uint32_t addr = 0x7c00 + 2*SECTOR_SIZE;
uint32_t base;
@@ -222,7 +222,6 @@ static void generate_extents(struct syslinux_extent *ex, int nptrs,
if (len) {
set_64(&ex->lba, lba);
set_16(&ex->len, len);
- printf("EXTENT: %11lu / %5u\n", lba, len);
ex++;
}
@@ -238,7 +237,6 @@ static void generate_extents(struct syslinux_extent *ex, int nptrs,
if (len) {
set_64(&ex->lba, lba);
set_16(&ex->len, len);
- printf("EXTENT: %11lu / %5u\n", lba, len);
ex++;
}
}
diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c
index c9eddec1..bc75ecf0 100644
--- a/libinstaller/syslxmod.c
+++ b/libinstaller/syslxmod.c
@@ -246,44 +246,43 @@ static __noinline void set_64_sl(uint64_t * p, uint64_t v)
static void generate_extents(struct syslinux_extent *ex, int nptrs,
const 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++;
}
}