]> git.proxmox.com Git - mirror_qemu.git/blame - qmp.c
qapi: Convert query-version
[mirror_qemu.git] / qmp.c
CommitLineData
48a32bed
AL
1/*
2 * QEMU Management Protocol
3 *
4 * Copyright IBM, Corp. 2011
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 */
13
14#include "qemu-common.h"
15#include "sysemu.h"
16#include "qmp-commands.h"
17
18NameInfo *qmp_query_name(Error **errp)
19{
20 NameInfo *info = g_malloc0(sizeof(*info));
21
22 if (qemu_name) {
23 info->has_name = true;
24 info->name = g_strdup(qemu_name);
25 }
26
27 return info;
28}
b9c15f16
LC
29
30VersionInfo *qmp_query_version(Error **err)
31{
32 VersionInfo *info = g_malloc0(sizeof(*info));
33 const char *version = QEMU_VERSION;
34 char *tmp;
35
36 info->qemu.major = strtol(version, &tmp, 10);
37 tmp++;
38 info->qemu.minor = strtol(tmp, &tmp, 10);
39 tmp++;
40 info->qemu.micro = strtol(tmp, &tmp, 10);
41 info->package = g_strdup(QEMU_PKGVERSION);
42
43 return info;
44}