vl: Switch qemu_uuid to QemuUUID

Update all qemu_uuid users as well, especially get rid of the duplicated
low level g_strdup_printf, sscanf and snprintf calls with QEMU UUID API.

Since qemu_uuid_parse is quite tangled with qemu_uuid, its switching to
QemuUUID is done here too to keep everything in sync and avoid code
churn.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-Id: <1474432046-325-10-git-send-email-famz@redhat.com>
This commit is contained in:
Fam Zheng 2016-09-21 12:27:22 +08:00
parent 315d318452
commit 9c5ce8db2e
12 changed files with 27 additions and 39 deletions

10
qmp.c
View file

@ -36,6 +36,7 @@
#include "qom/object_interfaces.h"
#include "hw/mem/pc-dimm.h"
#include "hw/acpi/acpi_dev_interface.h"
#include "qemu/uuid.h"
NameInfo *qmp_query_name(Error **errp)
{
@ -75,15 +76,8 @@ KvmInfo *qmp_query_kvm(Error **errp)
UuidInfo *qmp_query_uuid(Error **errp)
{
UuidInfo *info = g_malloc0(sizeof(*info));
char uuid[64];
snprintf(uuid, sizeof(uuid), UUID_FMT, qemu_uuid[0], qemu_uuid[1],
qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5],
qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9],
qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13],
qemu_uuid[14], qemu_uuid[15]);
info->UUID = g_strdup(uuid);
info->UUID = qemu_uuid_unparse_strdup(&qemu_uuid);
return info;
}