This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RedBoot fis free patch


>>>>> "Peter" == Peter Korsgaard <jacmet@sunsite.dk> writes:

Hi,

 Peter> Hi, The following patch fixes a issue in flash.c:find_free
 Peter> with splitting chunks in two when not final chunk.

Unfortunately my patch didn't completely fix the problem. No chunks
disappear, but the sorting order is not maintained. This patch fixes
it.

Sorry about that.

Index: packages/redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.228
diff -u -r1.228 ChangeLog
--- packages/redboot/current/ChangeLog	27 Jun 2005 18:17:36 -0000	1.228
+++ packages/redboot/current/ChangeLog	29 Jun 2005 13:50:08 -0000
@@ -1,3 +1,8 @@
+2005-06-29  Peter Korsgaard  <jacmet@sunsite.dk>
+
+	* src/flash.c (find_free): Maintain sort order when splitting
+	chunks.
+
 2005-06-27  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/net/enet.c (ntohs): Return type is a short.
Index: packages/redboot/current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.73
diff -u -r1.73 flash.c
--- packages/redboot/current/src/flash.c	27 Jun 2005 18:17:37 -0000	1.73
+++ packages/redboot/current/src/flash.c	29 Jun 2005 13:50:08 -0000
@@ -591,8 +591,12 @@
                     } else {
                         // Split chunk into two parts
                         if ((img->flash_base+img->size) < (CYG_ADDRESS)fis_end) {
-                            chunks[num_chunks].start = img->flash_base + img->size;
-                            chunks[num_chunks].end = chunks[idx].end;
+                            int j;
+                            // make room for new chunk
+                            for (j = num_chunks; j > (idx+1); j--)
+                                chunks[j] = chunks[j-1];
+                            chunks[idx+1].start = img->flash_base + img->size;
+                            chunks[idx+1].end = chunks[idx].end;
                             if (++num_chunks == CYGDAT_REDBOOT_FIS_MAX_FREE_CHUNKS) {
                                 diag_printf("Warning: too many free chunks\n");
                                 return num_chunks;
-- 
Bye, Peter Korsgaard

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]