[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 2/6] vmstate: add qom interface to get id
From: |
Daniel P . Berrangé |
Subject: |
Re: [Qemu-devel] [PATCH v3 2/6] vmstate: add qom interface to get id |
Date: |
Tue, 17 Sep 2019 13:33:57 +0100 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
On Thu, Sep 12, 2019 at 04:25:10PM +0400, Marc-André Lureau wrote:
> Add an interface to get the instance id, instead of depending on
> Device and qdev_get_dev_path().
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> hw/core/Makefile.objs | 1 +
> hw/core/qdev.c | 14 ++++++++++++++
> hw/core/vmstate-if.c | 23 +++++++++++++++++++++++
> include/hw/vmstate-if.h | 32 ++++++++++++++++++++++++++++++++
These two new files will want adding to some section of MAINTAINERS, since
there's no wildcard rule matching for these dirs currently.
> include/migration/register.h | 2 ++
> include/migration/vmstate.h | 2 ++
> tests/Makefile.include | 1 +
> 7 files changed, 75 insertions(+)
> create mode 100644 hw/core/vmstate-if.c
> create mode 100644 include/hw/vmstate-if.h
> diff --git a/include/hw/vmstate-if.h b/include/hw/vmstate-if.h
> new file mode 100644
> index 0000000000..92682f5bc2
> --- /dev/null
> +++ b/include/hw/vmstate-if.h
> @@ -0,0 +1,32 @@
License header
> +#ifndef VMSTATE_IF_H
> +#define VMSTATE_IF_H
> +
> +#include "qom/object.h"
> +
> +#define TYPE_VMSTATE_IF "vmstate-if"
> +
> +#define VMSTATE_IF_CLASS(klass) \
> + OBJECT_CLASS_CHECK(VMStateIfClass, (klass), TYPE_VMSTATE_IF)
> +#define VMSTATE_IF_GET_CLASS(obj) \
> + OBJECT_GET_CLASS(VMStateIfClass, (obj), TYPE_VMSTATE_IF)
> +#define VMSTATE_IF(obj) \
> + INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)
> +
> +typedef struct VMStateIf VMStateIf;
> +
> +typedef struct VMStateIfClass {
> + InterfaceClass parent_class;
> +
> + char * (*get_id)(VMStateIf *obj);
> +} VMStateIfClass;
> +
> +static inline char *vmstate_if_get_id(VMStateIf *vmif)
> +{
> + if (!vmif) {
> + return NULL;
> + }
> +
> + return VMSTATE_IF_GET_CLASS(vmif)->get_id(vmif);
> +}
With license header fixes
Reviewed-by: Daniel P. Berrangé <address@hidden>
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 :|
- [Qemu-devel] [PATCH v3 0/6] Add dbus-vmstate, Marc-André Lureau, 2019/09/12
- [Qemu-devel] [PATCH v3 1/6] migration: fix vmdesc leak on vmstate_save() error, Marc-André Lureau, 2019/09/12
- [Qemu-devel] [PATCH v3 2/6] vmstate: add qom interface to get id, Marc-André Lureau, 2019/09/12
- [Qemu-devel] [PATCH v3 3/6] vmstate: replace DeviceState with VMStateIf, Marc-André Lureau, 2019/09/12
- [Qemu-devel] [PATCH v3 4/6] tests: add qtest_expect_exit_status(), Marc-André Lureau, 2019/09/12
- [Qemu-devel] [PATCH v3 5/6] docs: start a document to describe D-Bus usage, Marc-André Lureau, 2019/09/12