From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Eric Blake <eblake@redhat.com>,
qemu-block@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH v2 3/5] block: rename RAMBlockRegistrar->notifier field
Date: Tue, 7 Oct 2025 14:34:45 -0400 [thread overview]
Message-ID: <20251007183447.93120-4-stefanha@redhat.com> (raw)
In-Reply-To: <20251007183447.93120-1-stefanha@redhat.com>
The 'notifier' field name will be confusing when the BlockBackend attach
and detach notifiers are added in the next commit. Rename the field so
it's clear that this is the RAMBlock notifier.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/system/block-ram-registrar.h | 2 +-
block/block-ram-registrar.c | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/system/block-ram-registrar.h b/include/system/block-ram-registrar.h
index d8b2f7942b..76c157bd54 100644
--- a/include/system/block-ram-registrar.h
+++ b/include/system/block-ram-registrar.h
@@ -21,7 +21,7 @@
*/
typedef struct {
BlockBackend *blk;
- RAMBlockNotifier notifier;
+ RAMBlockNotifier ram_block_notifier;
bool ok;
} BlockRAMRegistrar;
diff --git a/block/block-ram-registrar.c b/block/block-ram-registrar.c
index fcda2b86af..d5b84667a1 100644
--- a/block/block-ram-registrar.c
+++ b/block/block-ram-registrar.c
@@ -12,7 +12,8 @@
static void ram_block_added(RAMBlockNotifier *n, void *host, size_t size,
size_t max_size)
{
- BlockRAMRegistrar *r = container_of(n, BlockRAMRegistrar, notifier);
+ BlockRAMRegistrar *r =
+ container_of(n, BlockRAMRegistrar, ram_block_notifier);
Error *err = NULL;
if (!r->ok) {
@@ -21,7 +22,7 @@ static void ram_block_added(RAMBlockNotifier *n, void *host, size_t size,
if (!blk_register_buf(r->blk, host, max_size, &err)) {
error_report_err(err);
- ram_block_notifier_remove(&r->notifier);
+ ram_block_notifier_remove(n);
r->ok = false;
}
}
@@ -29,14 +30,15 @@ static void ram_block_added(RAMBlockNotifier *n, void *host, size_t size,
static void ram_block_removed(RAMBlockNotifier *n, void *host, size_t size,
size_t max_size)
{
- BlockRAMRegistrar *r = container_of(n, BlockRAMRegistrar, notifier);
+ BlockRAMRegistrar *r =
+ container_of(n, BlockRAMRegistrar, ram_block_notifier);
blk_unregister_buf(r->blk, host, max_size);
}
void blk_ram_registrar_init(BlockRAMRegistrar *r, BlockBackend *blk)
{
r->blk = blk;
- r->notifier = (RAMBlockNotifier){
+ r->ram_block_notifier = (RAMBlockNotifier){
.ram_block_added = ram_block_added,
.ram_block_removed = ram_block_removed,
@@ -47,12 +49,12 @@ void blk_ram_registrar_init(BlockRAMRegistrar *r, BlockBackend *blk)
};
r->ok = true;
- ram_block_notifier_add(&r->notifier);
+ ram_block_notifier_add(&r->ram_block_notifier);
}
void blk_ram_registrar_destroy(BlockRAMRegistrar *r)
{
if (r->ok) {
- ram_block_notifier_remove(&r->notifier);
+ ram_block_notifier_remove(&r->ram_block_notifier);
}
}
--
2.51.0
next prev parent reply other threads:[~2025-10-07 18:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 18:34 [PATCH v2 0/5] block: update inserted/removed nodes from BlockRAMRegistrar Stefan Hajnoczi
2025-10-07 18:34 ` [PATCH v2 1/5] block: add BdrvChildClass->propagate_attach/detach() callbacks Stefan Hajnoczi
2025-10-07 18:34 ` [PATCH v2 2/5] block: add blk_add_attach/detach_notifier() APIs Stefan Hajnoczi
2025-10-07 18:34 ` Stefan Hajnoczi [this message]
2025-10-07 18:34 ` [PATCH v2 4/5] block: update inserted/removed nodes from BlockRAMRegistrar Stefan Hajnoczi
2025-10-07 18:34 ` [PATCH v2 5/5] tests/functional: add vdpa-blk blockdev-mirror test Stefan Hajnoczi
2025-10-08 21:04 ` Eric Blake
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=20251007183447.93120-4-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=eblake@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.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).