[syslinux:pathbased] syslinux: synchronize generate_extents() with extlinux

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Tue Jun 15 16:27:02 PDT 2010


Commit-ID:  cbc69de20a19cbac90372fd7cbdaac00d1bbfa11
Gitweb:     http://syslinux.zytor.com/commit/cbc69de20a19cbac90372fd7cbdaac00d1bbfa11
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Tue, 15 Jun 2010 16:24:57 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Tue, 15 Jun 2010 16:24:57 -0700

syslinux: synchronize generate_extents() with extlinux

Synchronize the code for generate_extents() from extlinux to syslinux.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>


---
 libinstaller/syslxmod.c |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c
index c9eddec..6df753f 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++;
     }
 }



More information about the Syslinux-commits mailing list