qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v3 01/18] range: add Range structure
Date: Thu, 4 Jul 2013 12:12:39 +0300	[thread overview]
Message-ID: <1372928939-2712-2-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1372928939-2712-1-git-send-email-mst@redhat.com>

Sometimes we need to pass ranges around, add a
handy structure for this purpose.

Note: memory.c defines its own concept of AddrRange structure for
working with 128 addresses.  It's necessary there for doing range math.
This is not needed for most users: struct Range is
much simpler, and is only used for passing the range around.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/qemu/range.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/qemu/range.h b/include/qemu/range.h
index 3502372..b76cc0d 100644
--- a/include/qemu/range.h
+++ b/include/qemu/range.h
@@ -1,6 +1,22 @@
 #ifndef QEMU_RANGE_H
 #define QEMU_RANGE_H
 
+#include <inttypes.h>
+
+/*
+ * Operations on 64 bit address ranges.
+ * Notes:
+ *   - ranges must not wrap around 0, but can include the last byte ~0x0LL.
+ *   - this can not represent a full 0 to ~0x0LL range.
+ */
+
+/* A structure representing a range of addresses. */
+struct Range {
+    uint64_t begin; /* First byte of the range, or 0 if empty. */
+    uint64_t end;   /* 1 + the last byte. 0 if range empty or ends at ~0x0LL. */
+};
+typedef struct Range Range;
+
 /* Get last byte of a range from offset + length.
  * Undefined for ranges that wrap around 0. */
 static inline uint64_t range_get_last(uint64_t offset, uint64_t len)
-- 
MST

  reply	other threads:[~2013-07-04  9:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04  9:12 [Qemu-devel] [PULL v3 00/18] pci,misc enhancements Michael S. Tsirkin
2013-07-04  9:12 ` Michael S. Tsirkin [this message]
2013-07-04  9:12 ` [Qemu-devel] [PATCH v3 02/18] pci: store PCI hole ranges in guestinfo structure Michael S. Tsirkin
2013-07-04  9:12 ` [Qemu-devel] [PATCH v3 03/18] pc: pass PCI hole ranges to Guests Michael S. Tsirkin
2013-07-04  9:12 ` [Qemu-devel] [PATCH v3 04/18] pc_piix: cleanup init compat handling Michael S. Tsirkin
2013-07-04  9:12 ` [Qemu-devel] [PATCH v3 05/18] e1000: cleanup process_tx_desc Michael S. Tsirkin
2013-07-04  9:12 ` [Qemu-devel] [PATCH v3 06/18] MAINTAINERS: s/Marcelo/Paolo/ Michael S. Tsirkin
2013-07-04  9:12 ` [Qemu-devel] [PATCH v3 07/18] pvpanic: initialization cleanup Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 08/18] pvpanic: fix fwcfg for big endian hosts Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 09/18] pci: Cleanup configuration for pci-hotplug.c Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 10/18] pci: Move pci_read_devaddr to pci-hotplug-old.c Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 11/18] pci: Abolish pci_find_root_bus() Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 12/18] pci: Use helper to find device's root bus in pci_find_domain() Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 13/18] pci: Replace pci_find_domain() with more general pci_root_bus_path() Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 14/18] pci: Add root bus argument to pci_get_bus_devfn() Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 15/18] pci: Add root bus parameter to pci_nic_init() Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 16/18] pci: Simpler implementation of primary PCI bus Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 17/18] pci: Remove domain from PCIHostBus Michael S. Tsirkin
2013-07-04  9:13 ` [Qemu-devel] [PATCH v3 18/18] pci: Fold host_buses list into PCIHostState functionality Michael S. Tsirkin
2013-07-07 16:27 ` [Qemu-devel] [PULL v3 00/18] pci,misc enhancements Anthony Liguori
2013-07-07 20:08   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372928939-2712-2-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).