WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] rangesets: add function to query for overlaps
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Mon, 20 Sep 2010 14:07:55 +0100
Delivery-date: Mon, 20 Sep 2010 06:08:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] rangesets: add function to query for overlaps, Jan Beulich <=