mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
repart: Rework unused partition number algorithm
This commit is contained in:
@@ -1056,16 +1056,13 @@ static uint64_t find_first_unused_partno(Context *context) {
|
||||
|
||||
assert(context);
|
||||
|
||||
for (bool changed = true; changed;) {
|
||||
changed = false;
|
||||
|
||||
LIST_FOREACH(partitions, p, context->partitions) {
|
||||
if (p->partno != UINT64_MAX && p->partno == partno) {
|
||||
partno++;
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (partno = 0;; partno++) {
|
||||
bool found = false;
|
||||
LIST_FOREACH(partitions, p, context->partitions)
|
||||
if (p->partno != UINT64_MAX && p->partno == partno)
|
||||
found = true;
|
||||
if (!found)
|
||||
break;
|
||||
}
|
||||
|
||||
return partno;
|
||||
|
||||
Reference in New Issue
Block a user