Message ID | 1393765632-2753-7-git-send-email-marcel.a@redhat.com |
---|---|
State | New |
Headers | show |
Il 02/03/2014 14:07, Marcel Apfelbaum ha scritto: > Filter out also 'type' property when setting > object's properties > > Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> > --- > vl.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/vl.c b/vl.c > index c4939ef..dc206e1 100644 > --- a/vl.c > +++ b/vl.c > @@ -2766,7 +2766,8 @@ static int object_set_property(const char *name, const char *value, void *opaque > StringInputVisitor *siv; > Error *local_err = NULL; > > - if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0) { > + if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 || > + strcmp(name, "type") == 0) { > return 0; > } > > Unfortunately, it is quite possible to have a -object invocation where the object has a "type" property. I think you could change the -object implementation to use OptsVisitor, similar to hmp_object_add in hmp.c. Then the -object code can pre-parse "qom-type" and "id", while the -machine code can pre-parse "type". Paolo
On Mon, 2014-03-03 at 11:11 +0100, Paolo Bonzini wrote: > Il 02/03/2014 14:07, Marcel Apfelbaum ha scritto: > > Filter out also 'type' property when setting > > object's properties > > > > Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> > > --- > > vl.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/vl.c b/vl.c > > index c4939ef..dc206e1 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -2766,7 +2766,8 @@ static int object_set_property(const char *name, const char *value, void *opaque > > StringInputVisitor *siv; > > Error *local_err = NULL; > > > > - if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0) { > > + if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 || > > + strcmp(name, "type") == 0) { > > return 0; > > } > > > > > > Unfortunately, it is quite possible to have a -object invocation where > the object has a "type" property. Thanks, I was thinking that "type" is a built-in property of the Object, derived directly from class's type, so no one can "set" this property. > > I think you could change the -object implementation to use OptsVisitor, > similar to hmp_object_add in hmp.c. Then the -object code can pre-parse > "qom-type" and "id", while the -machine code can pre-parse "type". I'll look into it, thanks for the tip. Thanks, Marcel > > Paolo
Il 03/03/2014 13:09, Marcel Apfelbaum ha scritto: >> > Unfortunately, it is quite possible to have a -object invocation where >> > the object has a "type" property. > Thanks, I was thinking that "type" is a built-in property of the Object, > derived directly from class's type, so no one can "set" this property. Actually you're right. Perhaps we can make -object take "type" instead of "qom-type" too. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Paolo
diff --git a/vl.c b/vl.c index c4939ef..dc206e1 100644 --- a/vl.c +++ b/vl.c @@ -2766,7 +2766,8 @@ static int object_set_property(const char *name, const char *value, void *opaque StringInputVisitor *siv; Error *local_err = NULL; - if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0) { + if (strcmp(name, "qom-type") == 0 || strcmp(name, "id") == 0 || + strcmp(name, "type") == 0) { return 0; }
Filter out also 'type' property when setting object's properties Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> --- vl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)