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

[Xen-devel] [PATCH] rangesets: add function to query for overlaps



This will be used by a subsequent patch.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2010-06-15.orig/xen/common/rangeset.c       2009-11-05 10:13:22.000000000 
+0100
+++ 2010-06-15/xen/common/rangeset.c    2010-07-12 12:08:16.000000000 +0200
@@ -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)
--- 2010-06-15.orig/xen/include/xen/rangeset.h  2009-11-05 10:13:22.000000000 
+0100
+++ 2010-06-15/xen/include/xen/rangeset.h       2010-07-12 12:09:55.000000000 
+0200
@@ -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);



Attachment: rangeset-overlaps.patch
Description: Text document

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

 


Rackspace

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