From: "Andreas Färber" <afaerber@suse.de>
To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] qom: add object_class_get_instance_size()
Date: Mon, 11 Jan 2016 16:37:36 +0100 [thread overview]
Message-ID: <5693CC40.4060806@suse.de> (raw)
In-Reply-To: <1450452647-118105-2-git-send-email-imammedo@redhat.com>
Am 18.12.2015 um 16:30 schrieb Igor Mammedov:
> it will be used for allocating memory for a to be
> created new object in safe manner.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> include/qom/object.h | 8 ++++++++
> qom/object.c | 5 +++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/include/qom/object.h b/include/qom/object.h
> index 4509166..8f61b0b 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -880,6 +880,14 @@ bool object_class_is_abstract(ObjectClass *klass);
> */
> ObjectClass *object_class_by_name(const char *typename);
>
> +/**
> + * object_class_get_instance_size:
> + * @klass: The #ObjectClass to obtain instance size
> + *
> + * Returns: instance size of @klass
> + */
> +size_t object_class_get_instance_size(ObjectClass *klass);
> +
> void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
> const char *implements_type, bool include_abstract,
> void *opaque);
> diff --git a/qom/object.c b/qom/object.c
> index d751569..2f141ee 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -771,6 +771,11 @@ ObjectClass *object_class_get_parent(ObjectClass *class)
> return type->class;
> }
>
> +size_t object_class_get_instance_size(ObjectClass *klass)
> +{
> + return klass->type->instance_size;
> +}
> +
> typedef struct OCFData
> {
> void (*fn)(ObjectClass *klass, void *opaque);
I had previously proposed a type_get_instance_size() but did not get any
feedback: http://patchwork.ozlabs.org/patch/269591/
It was using name -> type, here you are using class -> type.
One does not necessarily exclude the other. :)
Regards,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2016-01-11 15:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 15:30 [Qemu-devel] [PATCH 0/2] qdev: fail safely if can't allocate device in device_add() Igor Mammedov
2015-12-18 15:30 ` [Qemu-devel] [PATCH 1/2] qom: add object_class_get_instance_size() Igor Mammedov
2016-01-11 15:37 ` Andreas Färber [this message]
2015-12-18 15:30 ` [Qemu-devel] [PATCH 2/2] qdev: safely fail device_add if unable to allocate device Igor Mammedov
2015-12-18 16:48 ` Daniel P. Berrange
2015-12-18 17:26 ` Eric Blake
2015-12-18 21:15 ` Markus Armbruster
2016-01-11 16:04 ` Andreas Färber
2016-01-12 15:43 ` Daniel P. Berrange
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=5693CC40.4060806@suse.de \
--to=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--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).