All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH for-6.0 v2 1/5] memory: Make flatview_cb return bool, not int
Date: Thu, 18 Mar 2021 17:48:19 +0000	[thread overview]
Message-ID: <20210318174823.18066-2-peter.maydell@linaro.org> (raw)
In-Reply-To: <20210318174823.18066-1-peter.maydell@linaro.org>

The return value of the flatview_cb callback passed to the
flatview_for_each_range() function is zero if the iteration through
the ranges should continue, or non-zero to break out of it.  Use a
bool for this rather than int.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/exec/memory.h           | 6 +++---
 tests/qtest/fuzz/generic_fuzz.c | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 54ccf1a5f09..22c10b8496a 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -776,9 +776,9 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as)
     return qatomic_rcu_read(&as->current_map);
 }
 
-typedef int (*flatview_cb)(Int128 start,
-                           Int128 len,
-                           const MemoryRegion*, void*);
+typedef bool (*flatview_cb)(Int128 start,
+                            Int128 len,
+                            const MemoryRegion*, void*);
 
 void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque);
 
diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
index b5fe27aae18..b6af4cbb18b 100644
--- a/tests/qtest/fuzz/generic_fuzz.c
+++ b/tests/qtest/fuzz/generic_fuzz.c
@@ -98,19 +98,19 @@ struct get_io_cb_info {
     address_range result;
 };
 
-static int get_io_address_cb(Int128 start, Int128 size,
-                          const MemoryRegion *mr, void *opaque) {
+static bool get_io_address_cb(Int128 start, Int128 size,
+                              const MemoryRegion *mr, void *opaque) {
     struct get_io_cb_info *info = opaque;
     if (g_hash_table_lookup(fuzzable_memoryregions, mr)) {
         if (info->index == 0) {
             info->result.addr = (ram_addr_t)start;
             info->result.size = (ram_addr_t)size;
             info->found = 1;
-            return 1;
+            return true;
         }
         info->index--;
     }
-    return 0;
+    return false;
 }
 
 /*
-- 
2.20.1



  reply	other threads:[~2021-03-18 17:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 17:48 [PATCH for-6.0 v2 0/5] arm: Make M-profile VTOR loads on reset handle memory aliasin Peter Maydell
2021-03-18 17:48 ` Peter Maydell [this message]
2021-03-18 18:39   ` [PATCH for-6.0 v2 1/5] memory: Make flatview_cb return bool, not int Richard Henderson
2021-03-18 20:55   ` Philippe Mathieu-Daudé
2021-03-18 17:48 ` [PATCH for-6.0 v2 2/5] memory: Document flatview_for_each_range() Peter Maydell
2021-03-18 18:40   ` Richard Henderson
2021-03-18 20:58   ` Philippe Mathieu-Daudé
2021-03-18 17:48 ` [PATCH for-6.0 v2 3/5] memory: Add offset_in_region to flatview_cb arguments Peter Maydell
2021-03-18 18:40   ` Richard Henderson
2021-03-18 21:01   ` Philippe Mathieu-Daudé
2021-03-18 17:48 ` [PATCH for-6.0 v2 4/5] hw/core/loader: Add new function rom_ptr_for_as() Peter Maydell
2021-03-18 18:44   ` Richard Henderson
2021-03-18 19:02     ` Peter Maydell
2021-03-18 21:14       ` Richard Henderson
2021-03-18 21:28         ` Peter Maydell
2021-03-18 21:56           ` Richard Henderson
2021-03-18 17:48 ` [PATCH for-6.0 v2 5/5] target/arm: Make M-profile VTOR loads on reset handle memory aliasing Peter Maydell
2021-03-18 18:44   ` Richard Henderson

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=20210318174823.18066-2-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.