On 2016/2/1 18:41, Daniel P. Berrange wrote:
On Wed, Jan 27, 2016 at 04:29:37PM +0800, zhanghailiang wrote:
Make the helper object_create() public and fix its first
parameter to accept NULL value.
Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>
---
v2:
- New patch
---
include/qemu-common.h | 2 ++
vl.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 22b010c..52cf4fd 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -500,4 +500,6 @@ int parse_debug_env(const char *name, int max, int initial);
const char *qemu_ether_ntoa(const MACAddr *mac);
void page_size_init(void);
+int object_create(void *opaque, QemuOpts *opts, Error **errp);
+
#endif
diff --git a/vl.c b/vl.c
index f043009..b21335e 100644
--- a/vl.c
+++ b/vl.c
@@ -2819,7 +2819,7 @@ static bool object_create_delayed(const char *type)
}
-static int object_create(void *opaque, QemuOpts *opts, Error **errp)
+int object_create(void *opaque, QemuOpts *opts, Error **errp)
{
Error *err = NULL;
char *type = NULL;
@@ -2842,7 +2842,7 @@ static int object_create(void *opaque, QemuOpts *opts,
Error **errp)
if (err) {
goto out;
}
- if (!type_predicate(type)) {
+ if (type_predicate && !type_predicate(type)) {
goto out;
}
No, please don't do this - your later patch should *not* be using
object_create, it should use object_new_with_props.
Er, i didn't notice this helper before, i will look into it.
Thanks,
Hailiang
Regards,
Daniel