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

Cyril Bur cyril.bur at au1.ibm.com
Thu Mar 15 16:58:19 AEDT 2018


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 4f1852ff..e115e427 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -610,25 +610,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.16.2



More information about the Skiboot mailing list