diff options
author | Eric Auger <eric.auger@redhat.com> | 2023-10-19 15:45:14 +0200 |
---|---|---|
committer | Cédric Le Goater <clg@redhat.com> | 2023-11-03 09:20:31 +0100 |
commit | b439595a08d79120325de4684698bb7b6516aa8a (patch) | |
tree | 200d2130e1868c97b5288a28d13a1872a5fb2a8c /include | |
parent | 908cae0de4fd63a58f5a7dc447f843a5be9cff46 (diff) | |
download | qemu-b439595a08d79120325de4684698bb7b6516aa8a.zip qemu-b439595a08d79120325de4684698bb7b6516aa8a.tar.gz qemu-b439595a08d79120325de4684698bb7b6516aa8a.tar.bz2 |
range: Introduce range_inverse_array()
This helper reverses a list of regions within a [low, high]
span, turning original regions into holes and original
holes into actual regions, covering the whole UINT64_MAX span.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Yanghang Liu <yanghliu@redhat.com>
Reviewed-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/range.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qemu/range.h b/include/qemu/range.h index aa671da..205e1da 100644 --- a/include/qemu/range.h +++ b/include/qemu/range.h @@ -225,4 +225,12 @@ int range_compare(Range *a, Range *b); GList *range_list_insert(GList *list, Range *data); +/* + * Inverse an array of sorted ranges over the [low, high] span, ie. + * original ranges becomes holes in the newly allocated inv_ranges + */ +void range_inverse_array(GList *in_ranges, + GList **out_ranges, + uint64_t low, uint64_t high); + #endif |