Changeset 1481
- Timestamp:
- 12/25/11 10:07:59 (5 months ago)
- File:
-
- 1 edited
-
trunk/layout.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/layout.c
r1473 r1481 216 216 } 217 217 218 int find_next_included_romentry(unsigned int start)218 romlayout_t *get_next_included_romentry(unsigned int start) 219 219 { 220 220 int i; 221 221 unsigned int best_start = UINT_MAX; 222 int best_entry = -1; 222 romlayout_t *best_entry = NULL; 223 romlayout_t *cur; 223 224 224 225 /* First come, first serve for overlapping regions. */ 225 226 for (i = 0; i < romimages; i++) { 226 if (!rom_entries[i].included) 227 cur = &rom_entries[i]; 228 if (!cur->included) 227 229 continue; 228 230 /* Already past the current entry? */ 229 if (start > rom_entries[i].end)231 if (start > cur->end) 230 232 continue; 231 233 /* Inside the current entry? */ 232 if (start >= rom_entries[i].start)233 return i;234 if (start >= cur->start) 235 return cur; 234 236 /* Entry begins after start. */ 235 if (best_start > rom_entries[i].start) {236 best_start = rom_entries[i].start;237 best_entry = i;237 if (best_start > cur->start) { 238 best_start = cur->start; 239 best_entry = cur; 238 240 } 239 241 } … … 244 246 { 245 247 unsigned int start = 0; 246 intentry;248 romlayout_t *entry; 247 249 unsigned int size = flash->total_size * 1024; 248 250 … … 256 258 */ 257 259 while (start < size) { 258 entry = find_next_included_romentry(start);260 entry = get_next_included_romentry(start); 259 261 /* No more romentries for remaining region? */ 260 if ( entry < 0) {262 if (!entry) { 261 263 memcpy(newcontents + start, oldcontents + start, 262 264 size - start); 263 265 break; 264 266 } 265 if ( rom_entries[entry].start > start)267 if (entry->start > start) 266 268 memcpy(newcontents + start, oldcontents + start, 267 rom_entries[entry].start - start);269 entry->start - start); 268 270 /* Skip to location after current romentry. */ 269 start = rom_entries[entry].end + 1;271 start = entry->end + 1; 270 272 /* Catch overflow. */ 271 273 if (!start) 272 274 break; 273 275 } 274 275 276 return 0; 276 277 }
Note: See TracChangeset
for help on using the changeset viewer.
