]> git.ipfire.org Git - thirdparty/systemd.git/commit
repart: Sort the partition list by partition offset 42488/head
authorJonas Dreßler <verdre@v0yd.nl>
Fri, 29 May 2026 23:25:45 +0000 (01:25 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 21 Jun 2026 23:26:14 +0000 (00:26 +0100)
commit9c57f703d25a2f49b9a989699139b1c68dfda9c3
treef448f8610a7dec6b30a86d9dc12c6855d84a46ba
parentcc74f8bf3649115c372d2b48cbab3c710db751d0
repart: Sort the partition list by partition offset

Currently the partition list is ordered like this: First come the partitions that
exist as definition files (could be pre-existing partitions or could be new ones),
then come the pre-existing partitions that aren't matched to a definition file.

This ordering is visible to the user when we print our partition table, and it
doesn't really make sense from a UX perspective: Partition tables are usually
either presented in order of the partition indices, or in order of the partition
offsets. Arguably the latter would be nicer here, since the visualization below
is already ordered by physical offsets.

So reorder the list after we assigned the new partitions to their respective free
areas, according to the physical offset (or, for partitions to newly create, the
order that we will allocate them in).

Another potential upside of this is that we could rely on the partition order in
the code now more, too.

To ensure it keeps working, also add a test in the integration tests for it.
src/repart/repart.c
test/units/TEST-58-REPART.sh