Re: [Qemu-devel] [PATCH 1/7] pci: add range_covers_range()

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

 



This function seems same to ranges_overlap().
Please use ranges_overlap().

On Sun, Aug 15, 2010 at 10:27:16PM +0300, Eduard - Gabriel Munteanu wrote:
> This helper function allows map invalidation code to determine which
> maps must be invalidated.
> 
> Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@xxxxxxxxxxx>
> ---
>  hw/pci.h |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.h b/hw/pci.h
> index 4bd8a1a..5a6cdb5 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -419,6 +419,16 @@ static inline int range_covers_byte(uint64_t offset, uint64_t len,
>      return offset <= byte && byte <= range_get_last(offset, len);
>  }
>  
> +/* Check whether a given range completely covers another. */
> +static inline int range_covers_range(uint64_t first_big, uint64_t len_big,
> +                                     uint64_t first_small, uint64_t len_small)
> +{
> +    uint64_t last_big = range_get_last(first_big, len_big);
> +    uint64_t last_small = range_get_last(first_small, len_small);
> +
> +    return first_big <= first_small && last_small <= last_big;
> +}
> +
>  /* Check whether 2 given ranges overlap.
>   * Undefined if ranges that wrap around 0. */
>  static inline int ranges_overlap(uint64_t first1, uint64_t len1,
> -- 
> 1.7.1
> 
> 

-- 
yamahata
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux