
On Thu, Dec 19, 2024 at 04:38:50PM +0100, Philippe Mathieu-Daudé wrote:
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/misc/vmcoreinfo.h | 13 ++++++------- hw/misc/vmcoreinfo.c | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 10 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index ad5a4dec596..c5bb5c9fa52 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -42,11 +42,12 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp) /* for gdb script dump-guest-memory.py */ static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED;
- /* Given that this function is executing, there is at least one VMCOREINFO - * device. Check if there are several. + /* + * Given that this function is executing, there is at least one + * VMCOREINFO instance. Check if there are several. */ if (!vmcoreinfo_find()) { - error_setg(errp, "at most one %s device is permitted", + error_setg(errp, "at most one %s instance is permitted", VMCOREINFO_DEVICE); return; }
This chunk is unrelated to the claimed goal of this commit. It makes sense as a change though, so feel free to add my R-B when splitting into a separate commit.
@@ -103,3 +104,12 @@ static const TypeInfo vmcoreinfo_types[] = { };
DEFINE_TYPES(vmcoreinfo_types) + +VMCoreInfoState *vmcoreinfo_find(void) +{ + Object *obj; + + obj = object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); + + return obj ? (VMCoreInfoState *)obj : NULL; +}
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-- 2.47.1
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|