- SD_JOURNAL_FOREACH_UNIQUE(j, data, length) {
- if (length < strlen("_BOOT_ID="))
- continue;
-
- if (!GREEDY_REALLOC(all_ids, allocated, count + 1))
- return log_oom();
-
- id = &all_ids[count];
-
- r = sd_id128_from_string(((const char *)data) + strlen("_BOOT_ID="), &id->id);
- if (r < 0)
- continue;
-
- r = sd_journal_add_match(j, data, length);
- if (r < 0)
- return r;
-
- r = sd_journal_seek_head(j);
- if (r < 0)
- return r;
-
- r = sd_journal_next(j);
- if (r < 0)
- return r;
- else if (r == 0)
- goto flush;
-
- r = sd_journal_get_realtime_usec(j, &id->first);
- if (r < 0)
- return r;
-
- if (sd_id128_equal(id->id, *boot_id))
- ref_boot_id = *id;
-
- count++;
- flush:
- sd_journal_flush_matches(j);
- }
-
- qsort_safe(all_ids, count, sizeof(boot_id_t), boot_id_cmp);
-