[Skiboot] [RFC PATCH 07/13] libflash/libffs: Always add entries to the end of the TOC

Cyril Bur cyril.bur at au1.ibm.com
Tue Aug 29 16:25:00 AEST 2017


It turns out that sorted order isn't the best idea. This removes
flexibility from the caller. If the user wants their partitions in
sorted order, they should insert them in sorted order.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 libflash/libffs.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/libflash/libffs.c b/libflash/libffs.c
index 822169b7..0159c07b 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -598,25 +598,7 @@ static int __ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry)
 		return FFS_ERR_BAD_PART_BASE;
 	}
 
-	/*
-	 * A header can't have zero entries. Was asserted.
-	 */
-	list_for_each(&hdr->entries, ent, list)
-		if (entry->base < ent->base)
-			break;
-
-	if (ent == list_top(&hdr->entries, struct ffs_entry, list)) {
-		/*
-		 * This should never happen because the partition entry
-		 * should ALWAYS be here
-		 */
-		fprintf(stderr, "Warning: replacing first entry in FFS header\n");
-		list_add(&hdr->entries, &entry->list);
-	} else if (!ent) {
-		list_add_tail(&hdr->entries, &entry->list);
-	} else {
-		list_add_before(&hdr->entries, &entry->list, &ent->list);
-	}
+	list_add_tail(&hdr->entries, &entry->list);
 
 	return 0;
 }
-- 
2.14.1



More information about the Skiboot mailing list