diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/range.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/range.h b/include/linux/range.h index 6ad0b73cb7ad..876cd5355158 100644 --- a/include/linux/range.h +++ b/include/linux/range.h @@ -13,11 +13,19 @@ static inline u64 range_len(const struct range *range) return range->end - range->start + 1; } +/* True if r1 completely contains r2 */ static inline bool range_contains(struct range *r1, struct range *r2) { return r1->start <= r2->start && r1->end >= r2->end; } +/* True if any part of r1 overlaps r2 */ +static inline bool range_overlaps(const struct range *r1, + const struct range *r2) +{ + return r1->start <= r2->end && r1->end >= r2->start; +} + int add_range(struct range *range, int az, int nr_range, u64 start, u64 end); |
