Yinghai Lu | 27811d8 | 2010-02-10 01:20:07 -0800 | [diff] [blame] | 1 | #ifndef _LINUX_RANGE_H |
| 2 | #define _LINUX_RANGE_H |
| 3 | |
| 4 | struct range { |
| 5 | u64 start; |
| 6 | u64 end; |
| 7 | }; |
| 8 | |
| 9 | int add_range(struct range *range, int az, int nr_range, |
| 10 | u64 start, u64 end); |
| 11 | |
| 12 | |
| 13 | int add_range_with_merge(struct range *range, int az, int nr_range, |
| 14 | u64 start, u64 end); |
| 15 | |
| 16 | void subtract_range(struct range *range, int az, u64 start, u64 end); |
| 17 | |
| 18 | int clean_sort_range(struct range *range, int az); |
| 19 | |
| 20 | void sort_range(struct range *range, int nr_range); |
| 21 | |
Yinghai Lu | 9ad3f2c | 2010-02-10 01:20:11 -0800 | [diff] [blame] | 22 | #define MAX_RESOURCE ((resource_size_t)~0) |
| 23 | static inline resource_size_t cap_resource(u64 val) |
| 24 | { |
| 25 | if (val > MAX_RESOURCE) |
| 26 | return MAX_RESOURCE; |
| 27 | |
| 28 | return val; |
| 29 | } |
Yinghai Lu | 27811d8 | 2010-02-10 01:20:07 -0800 | [diff] [blame] | 30 | #endif |