thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 3ed0fb61a3dc912ef036d7ef450bed192090709e Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
9ae3a8
From: "Michael S. Tsirkin" <mst@redhat.com>
9ae3a8
Date: Tue, 17 Dec 2013 15:16:49 +0100
9ae3a8
Subject: [PATCH 01/56] range: add Range structure
9ae3a8
9ae3a8
RH-Author: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Message-id: <1387293161-4085-2-git-send-email-mst@redhat.com>
9ae3a8
Patchwork-id: 56306
9ae3a8
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 01/57] range: add Range structure
9ae3a8
Bugzilla: 1034876
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
Sometimes we need to pass ranges around, add a
9ae3a8
handy structure for this purpose.
9ae3a8
9ae3a8
Note: memory.c defines its own concept of AddrRange structure for
9ae3a8
working with 128 addresses.  It's necessary there for doing range math.
9ae3a8
This is not needed for most users: struct Range is
9ae3a8
much simpler, and is only used for passing the range around.
9ae3a8
9ae3a8
Cc: Peter Maydell <peter.maydell@linaro.org>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
(cherry picked from commit 620ac82eb0fc4218fb6a4937bcef3fdab3126703)
9ae3a8
---
9ae3a8
 include/qemu/range.h | 16 ++++++++++++++++
9ae3a8
 1 file changed, 16 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 include/qemu/range.h | 16 ++++++++++++++++
9ae3a8
 1 file changed, 16 insertions(+)
9ae3a8
9ae3a8
diff --git a/include/qemu/range.h b/include/qemu/range.h
9ae3a8
index 3502372..b76cc0d 100644
9ae3a8
--- a/include/qemu/range.h
9ae3a8
+++ b/include/qemu/range.h
9ae3a8
@@ -1,6 +1,22 @@
9ae3a8
 #ifndef QEMU_RANGE_H
9ae3a8
 #define QEMU_RANGE_H
9ae3a8
 
9ae3a8
+#include <inttypes.h>
9ae3a8
+
9ae3a8
+/*
9ae3a8
+ * Operations on 64 bit address ranges.
9ae3a8
+ * Notes:
9ae3a8
+ *   - ranges must not wrap around 0, but can include the last byte ~0x0LL.
9ae3a8
+ *   - this can not represent a full 0 to ~0x0LL range.
9ae3a8
+ */
9ae3a8
+
9ae3a8
+/* A structure representing a range of addresses. */
9ae3a8
+struct Range {
9ae3a8
+    uint64_t begin; /* First byte of the range, or 0 if empty. */
9ae3a8
+    uint64_t end;   /* 1 + the last byte. 0 if range empty or ends at ~0x0LL. */
9ae3a8
+};
9ae3a8
+typedef struct Range Range;
9ae3a8
+
9ae3a8
 /* Get last byte of a range from offset + length.
9ae3a8
  * Undefined for ranges that wrap around 0. */
9ae3a8
 static inline uint64_t range_get_last(uint64_t offset, uint64_t len)
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8