[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties
From: |
Gonglei (Arei) |
Subject: |
Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties |
Date: |
Mon, 22 Sep 2014 13:13:43 +0000 |
> -----Original Message-----
> From: Paolo Bonzini [mailto:address@hidden On Behalf Of Paolo
> Bonzini
> Sent: Monday, September 22, 2014 8:07 PM
> To: Gonglei (Arei); Michael S. Tsirkin
> Cc: address@hidden; Huangweidong (C); address@hidden; Huangpeng
> (Peter); address@hidden; address@hidden;
> address@hidden
> Subject: Re: [PATCH 0/3] Fix confused output for alias properties
>
> Il 22/09/2014 13:22, Gonglei (Arei) ha scritto:
> > > This doesn't change the fact that ObjectProperty is a generic struct,
> > > and adding alias-specific fields there is wrong.
> >
> > OK, Maybe I should find other ways to attach this purpose and
> > avoid layering violation. Thanks!
>
> Unfortunately I cannot think of any.
>
What about this below way? Thanks!
(I don't add alias-sepecific filed into ObjectProperty
struct, just add a bool property. )
diff --git a/include/qom/object.h b/include/qom/object.h
index 8a05a81..8b8ded5 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -334,6 +334,11 @@ typedef void (ObjectPropertyRelease)(Object *obj,
const char *name,
void *opaque);
+typedef struct {
+ Object *target_obj;
+ const char *target_name;
+} AliasProperty;
+
typedef struct ObjectProperty
{
gchar *name;
@@ -344,6 +349,8 @@ typedef struct ObjectProperty
ObjectPropertyRelease *release;
void *opaque;
+ bool is_alias;
+
QTAILQ_ENTRY(ObjectProperty) node;
} ObjectProperty;
diff --git a/qom/object.c b/qom/object.c
index a8c3065..0b4e402 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1590,11 +1590,6 @@ void object_property_add_uint64_ptr(Object *obj, const
char *name,
NULL, NULL, (void *)v, errp);
}
-typedef struct {
- Object *target_obj;
- const char *target_name;
-} AliasProperty;
-
static void property_get_alias(Object *obj, struct Visitor *v, void *opaque,
const char *name, Error **errp)
{
@@ -1663,6 +1658,7 @@ void object_property_add_alias(Object *obj, const char
*name,
goto out;
}
op->resolve = property_resolve_alias;
+ op->is_alias = true;
out:
g_free(prop_type);
--
1.7.12.4
> We could add a description field to ObjectProperty, and replace
> legacy_name with a description. The output then would be
>
> virtio-blk.drive=str (drive)
>
> That's a bit hackish, but perhaps it would be good enough for mst and
> Markus?
>
> Paolo
Best regards,
-Gonglei
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, (continued)
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Michael S. Tsirkin, 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Paolo Bonzini, 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Gonglei (Arei), 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Paolo Bonzini, 2014/09/23
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Gonglei (Arei), 2014/09/23
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Markus Armbruster, 2014/09/23
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Markus Armbruster, 2014/09/23
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Michael S. Tsirkin, 2014/09/23
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Gonglei (Arei), 2014/09/23
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Markus Armbruster, 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties,
Gonglei (Arei) <=
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Paolo Bonzini, 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Gonglei (Arei), 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Paolo Bonzini, 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Gonglei (Arei), 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Gonglei (Arei), 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Markus Armbruster, 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Paolo Bonzini, 2014/09/22
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Michael S. Tsirkin, 2014/09/23
- Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Markus Armbruster, 2014/09/23
Re: [Qemu-devel] [PATCH 0/3] Fix confused output for alias properties, Markus Armbruster, 2014/09/22