[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] rangesets: add function to query for overlaps



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1285005006 -3600
# Node ID fecdbe814a9fc80a3c18a654c57757380000c269
# Parent  0bc640853cfd71b2fc6a68e95c45df2fd2d3a2f3
rangesets: add function to query for overlaps

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/common/rangeset.c      |   16 ++++++++++++++++
 xen/include/xen/rangeset.h |    2 ++
 2 files changed, 18 insertions(+)

diff -r 0bc640853cfd -r fecdbe814a9f xen/common/rangeset.c
--- a/xen/common/rangeset.c     Mon Sep 20 18:49:15 2010 +0100
+++ b/xen/common/rangeset.c     Mon Sep 20 18:50:06 2010 +0100
@@ -251,6 +251,22 @@ int rangeset_contains_range(
     return contains;
 }
 
+int rangeset_overlaps_range(
+    struct rangeset *r, unsigned long s, unsigned long e)
+{
+    struct range *x;
+    int overlaps;
+
+    ASSERT(s <= e);
+
+    spin_lock(&r->lock);
+    x = find_range(r, e);
+    overlaps = (x && (s <= x->e));
+    spin_unlock(&r->lock);
+
+    return overlaps;
+}
+
 int rangeset_report_ranges(
     struct rangeset *r, unsigned long s, unsigned long e,
     int (*cb)(unsigned long s, unsigned long e, void *), void *ctxt)
diff -r 0bc640853cfd -r fecdbe814a9f xen/include/xen/rangeset.h
--- a/xen/include/xen/rangeset.h        Mon Sep 20 18:49:15 2010 +0100
+++ b/xen/include/xen/rangeset.h        Mon Sep 20 18:50:06 2010 +0100
@@ -53,6 +53,8 @@ int __must_check rangeset_remove_range(
     struct rangeset *r, unsigned long s, unsigned long e);
 int __must_check rangeset_contains_range(
     struct rangeset *r, unsigned long s, unsigned long e);
+int __must_check rangeset_overlaps_range(
+    struct rangeset *r, unsigned long s, unsigned long e);
 int rangeset_report_ranges(
     struct rangeset *r, unsigned long s, unsigned long e,
     int (*cb)(unsigned long s, unsigned long e, void *), void *ctxt);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.