[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] rangeset: introduce rangeset_merge
commit 761de0b8920c35993a0b6559ceb416155ac5407a Author: Roger Pau Monne <roger.pau@xxxxxxxxxx> AuthorDate: Tue Jul 17 11:48:26 2018 +0200 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Oct 17 14:28:30 2018 +0100 rangeset: introduce rangeset_merge This new helper will merge two rangesets. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/common/rangeset.c | 12 ++++++++++++ xen/include/xen/rangeset.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c index e3857ab816..f34cafdc7e 100644 --- a/xen/common/rangeset.c +++ b/xen/common/rangeset.c @@ -384,6 +384,18 @@ int rangeset_consume_ranges(struct rangeset *r, return rc; } +static int merge(unsigned long s, unsigned long e, void *data) +{ + struct rangeset *r = data; + + return rangeset_add_range(r, s, e); +} + +int rangeset_merge(struct rangeset *r1, struct rangeset *r2) +{ + return rangeset_report_ranges(r2, 0, ~0ul, merge, r1); +} + int rangeset_add_singleton( struct rangeset *r, unsigned long s) { diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h index 583b72bb0c..0c05c2fd4e 100644 --- a/xen/include/xen/rangeset.h +++ b/xen/include/xen/rangeset.h @@ -80,6 +80,9 @@ int rangeset_consume_ranges(struct rangeset *r, void *, unsigned long *c), void *ctxt); +/* Merge rangeset r2 into rangeset r1. */ +int __must_check rangeset_merge(struct rangeset *r1, struct rangeset *r2); + /* Add/remove/query a single number. */ int __must_check rangeset_add_singleton( struct rangeset *r, unsigned long s); -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |