mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
qapi: Use QAPI_LIST_PREPEND() where possible
Anywhere we create a list of just one item or by prepending items (typically because order doesn't matter), we can use QAPI_LIST_PREPEND(). But places where we must keep the list in order by appending remain open-coded until later patches. Note that as a side effect, this also performs a cleanup of two minor issues in qga/commands-posix.c: the old code was performing new = g_malloc0(sizeof(*ret)); which 1) is confusing because you have to verify whether 'new' and 'ret' are variables with the same type, and 2) would conflict with C++ compilation (not an actual problem for this file, but makes copy-and-paste harder). Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20201113011340.463563-5-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> [Straightforward conflicts due to commita8aa94b5f8"qga: update schema for guest-get-disks 'dependents' field" and commita10b453a52"target/mips: Move mips_cpu_add_definition() from helper.c to cpu.c" resolved. Commit message tweaked.] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
committed by
Markus Armbruster
parent
eaedde5255
commit
54aa3de72e
+2
-2
@@ -359,8 +359,8 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gconf->server = g_new0(SocketAddressList, 1);
|
gsconf = g_new0(SocketAddress, 1);
|
||||||
gconf->server->value = gsconf = g_new0(SocketAddress, 1);
|
QAPI_LIST_PREPEND(gconf->server, gsconf);
|
||||||
|
|
||||||
/* transport */
|
/* transport */
|
||||||
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
|
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
|
||||||
|
|||||||
+2
-5
@@ -486,12 +486,7 @@ static void bdrv_query_blk_stats(BlockDeviceStats *ds, BlockBackend *blk)
|
|||||||
ds->account_failed = stats->account_failed;
|
ds->account_failed = stats->account_failed;
|
||||||
|
|
||||||
while ((ts = block_acct_interval_next(stats, ts))) {
|
while ((ts = block_acct_interval_next(stats, ts))) {
|
||||||
BlockDeviceTimedStatsList *timed_stats =
|
|
||||||
g_malloc0(sizeof(*timed_stats));
|
|
||||||
BlockDeviceTimedStats *dev_stats = g_malloc0(sizeof(*dev_stats));
|
BlockDeviceTimedStats *dev_stats = g_malloc0(sizeof(*dev_stats));
|
||||||
timed_stats->next = ds->timed_stats;
|
|
||||||
timed_stats->value = dev_stats;
|
|
||||||
ds->timed_stats = timed_stats;
|
|
||||||
|
|
||||||
TimedAverage *rd = &ts->latency[BLOCK_ACCT_READ];
|
TimedAverage *rd = &ts->latency[BLOCK_ACCT_READ];
|
||||||
TimedAverage *wr = &ts->latency[BLOCK_ACCT_WRITE];
|
TimedAverage *wr = &ts->latency[BLOCK_ACCT_WRITE];
|
||||||
@@ -515,6 +510,8 @@ static void bdrv_query_blk_stats(BlockDeviceStats *ds, BlockBackend *blk)
|
|||||||
block_acct_queue_depth(ts, BLOCK_ACCT_READ);
|
block_acct_queue_depth(ts, BLOCK_ACCT_READ);
|
||||||
dev_stats->avg_wr_queue_depth =
|
dev_stats->avg_wr_queue_depth =
|
||||||
block_acct_queue_depth(ts, BLOCK_ACCT_WRITE);
|
block_acct_queue_depth(ts, BLOCK_ACCT_WRITE);
|
||||||
|
|
||||||
|
QAPI_LIST_PREPEND(ds->timed_stats, dev_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
bdrv_latency_histogram_stats(&stats->latency_histogram[BLOCK_ACCT_READ],
|
bdrv_latency_histogram_stats(&stats->latency_histogram[BLOCK_ACCT_READ],
|
||||||
|
|||||||
+8
-12
@@ -776,15 +776,13 @@ static int qmp_query_chardev_foreach(Object *obj, void *data)
|
|||||||
{
|
{
|
||||||
Chardev *chr = CHARDEV(obj);
|
Chardev *chr = CHARDEV(obj);
|
||||||
ChardevInfoList **list = data;
|
ChardevInfoList **list = data;
|
||||||
ChardevInfoList *info = g_malloc0(sizeof(*info));
|
ChardevInfo *value = g_malloc0(sizeof(*value));
|
||||||
|
|
||||||
info->value = g_malloc0(sizeof(*info->value));
|
value->label = g_strdup(chr->label);
|
||||||
info->value->label = g_strdup(chr->label);
|
value->filename = g_strdup(chr->filename);
|
||||||
info->value->filename = g_strdup(chr->filename);
|
value->frontend_open = chr->be && chr->be->fe_open;
|
||||||
info->value->frontend_open = chr->be && chr->be->fe_open;
|
|
||||||
|
|
||||||
info->next = *list;
|
QAPI_LIST_PREPEND(*list, value);
|
||||||
*list = info;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -803,12 +801,10 @@ static void
|
|||||||
qmp_prepend_backend(const char *name, void *opaque)
|
qmp_prepend_backend(const char *name, void *opaque)
|
||||||
{
|
{
|
||||||
ChardevBackendInfoList **list = opaque;
|
ChardevBackendInfoList **list = opaque;
|
||||||
ChardevBackendInfoList *info = g_malloc0(sizeof(*info));
|
ChardevBackendInfo *value = g_new0(ChardevBackendInfo, 1);
|
||||||
|
|
||||||
info->value = g_malloc0(sizeof(*info->value));
|
value->name = g_strdup(name);
|
||||||
info->value->name = g_strdup(name);
|
QAPI_LIST_PREPEND(*list, value);
|
||||||
info->next = *list;
|
|
||||||
*list = info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChardevBackendInfoList *qmp_query_chardev_backends(Error **errp)
|
ChardevBackendInfoList *qmp_query_chardev_backends(Error **errp)
|
||||||
|
|||||||
@@ -531,15 +531,11 @@ TimerAlarmMethodList *qmp_query_alarm_methods(Error **errp)
|
|||||||
bool current = true;
|
bool current = true;
|
||||||
|
|
||||||
for (p = alarm_timers; p->name; p++) {
|
for (p = alarm_timers; p->name; p++) {
|
||||||
TimerAlarmMethodList *info = g_malloc0(sizeof(*info));
|
TimerAlarmMethod *value = g_malloc0(*value);
|
||||||
info->value = g_malloc0(sizeof(*info->value));
|
value->method_name = g_strdup(p->name);
|
||||||
info->value->method_name = g_strdup(p->name);
|
value->current = current;
|
||||||
info->value->current = current;
|
QAPI_LIST_PREPEND(method_list, value);
|
||||||
|
|
||||||
current = false;
|
current = false;
|
||||||
|
|
||||||
info->next = method_list;
|
|
||||||
method_list = info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return method_list;
|
return method_list;
|
||||||
|
|||||||
@@ -215,7 +215,6 @@ MachineInfoList *qmp_query_machines(Error **errp)
|
|||||||
|
|
||||||
for (el = machines; el; el = el->next) {
|
for (el = machines; el; el = el->next) {
|
||||||
MachineClass *mc = el->data;
|
MachineClass *mc = el->data;
|
||||||
MachineInfoList *entry;
|
|
||||||
MachineInfo *info;
|
MachineInfo *info;
|
||||||
|
|
||||||
info = g_malloc0(sizeof(*info));
|
info = g_malloc0(sizeof(*info));
|
||||||
@@ -243,10 +242,7 @@ MachineInfoList *qmp_query_machines(Error **errp)
|
|||||||
info->has_default_ram_id = true;
|
info->has_default_ram_id = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = g_malloc0(sizeof(*entry));
|
QAPI_LIST_PREPEND(mach_list, info);
|
||||||
entry->value = info;
|
|
||||||
entry->next = mach_list;
|
|
||||||
mach_list = entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free(machines);
|
g_slist_free(machines);
|
||||||
|
|||||||
+2
-9
@@ -504,11 +504,7 @@ static void machine_set_nvdimm_persistence(Object *obj, const char *value,
|
|||||||
|
|
||||||
void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type)
|
void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type)
|
||||||
{
|
{
|
||||||
strList *item = g_new0(strList, 1);
|
QAPI_LIST_PREPEND(mc->allowed_dynamic_sysbus_devices, g_strdup(type));
|
||||||
|
|
||||||
item->value = g_strdup(type);
|
|
||||||
item->next = mc->allowed_dynamic_sysbus_devices;
|
|
||||||
mc->allowed_dynamic_sysbus_devices = item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque)
|
static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque)
|
||||||
@@ -569,7 +565,6 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
|
|||||||
|
|
||||||
for (i = 0; i < machine->possible_cpus->len; i++) {
|
for (i = 0; i < machine->possible_cpus->len; i++) {
|
||||||
Object *cpu;
|
Object *cpu;
|
||||||
HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
|
|
||||||
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
|
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
|
||||||
|
|
||||||
cpu_item->type = g_strdup(machine->possible_cpus->cpus[i].type);
|
cpu_item->type = g_strdup(machine->possible_cpus->cpus[i].type);
|
||||||
@@ -582,9 +577,7 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
|
|||||||
cpu_item->has_qom_path = true;
|
cpu_item->has_qom_path = true;
|
||||||
cpu_item->qom_path = object_get_canonical_path(cpu);
|
cpu_item->qom_path = object_get_canonical_path(cpu);
|
||||||
}
|
}
|
||||||
list_item->value = cpu_item;
|
QAPI_LIST_PREPEND(head, cpu_item);
|
||||||
list_item->next = head;
|
|
||||||
head = list_item;
|
|
||||||
}
|
}
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2296,7 +2296,6 @@ static void of_dpa_flow_fill(void *cookie, void *value, void *user_data)
|
|||||||
struct of_dpa_flow_key *key = &flow->key;
|
struct of_dpa_flow_key *key = &flow->key;
|
||||||
struct of_dpa_flow_key *mask = &flow->mask;
|
struct of_dpa_flow_key *mask = &flow->mask;
|
||||||
struct of_dpa_flow_fill_context *flow_context = user_data;
|
struct of_dpa_flow_fill_context *flow_context = user_data;
|
||||||
RockerOfDpaFlowList *new;
|
|
||||||
RockerOfDpaFlow *nflow;
|
RockerOfDpaFlow *nflow;
|
||||||
RockerOfDpaFlowKey *nkey;
|
RockerOfDpaFlowKey *nkey;
|
||||||
RockerOfDpaFlowMask *nmask;
|
RockerOfDpaFlowMask *nmask;
|
||||||
@@ -2307,8 +2306,7 @@ static void of_dpa_flow_fill(void *cookie, void *value, void *user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new = g_malloc0(sizeof(*new));
|
nflow = g_malloc0(sizeof(*nflow));
|
||||||
nflow = new->value = g_malloc0(sizeof(*nflow));
|
|
||||||
nkey = nflow->key = g_malloc0(sizeof(*nkey));
|
nkey = nflow->key = g_malloc0(sizeof(*nkey));
|
||||||
nmask = nflow->mask = g_malloc0(sizeof(*nmask));
|
nmask = nflow->mask = g_malloc0(sizeof(*nmask));
|
||||||
naction = nflow->action = g_malloc0(sizeof(*naction));
|
naction = nflow->action = g_malloc0(sizeof(*naction));
|
||||||
@@ -2424,8 +2422,7 @@ static void of_dpa_flow_fill(void *cookie, void *value, void *user_data)
|
|||||||
naction->new_vlan_id = flow->action.apply.new_vlan_id;
|
naction->new_vlan_id = flow->action.apply.new_vlan_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
new->next = flow_context->list;
|
QAPI_LIST_PREPEND(flow_context->list, nflow);
|
||||||
flow_context->list = new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RockerOfDpaFlowList *qmp_query_rocker_of_dpa_flows(const char *name,
|
RockerOfDpaFlowList *qmp_query_rocker_of_dpa_flows(const char *name,
|
||||||
@@ -2469,9 +2466,7 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
|
|||||||
{
|
{
|
||||||
struct of_dpa_group *group = value;
|
struct of_dpa_group *group = value;
|
||||||
struct of_dpa_group_fill_context *flow_context = user_data;
|
struct of_dpa_group_fill_context *flow_context = user_data;
|
||||||
RockerOfDpaGroupList *new;
|
|
||||||
RockerOfDpaGroup *ngroup;
|
RockerOfDpaGroup *ngroup;
|
||||||
struct uint32List *id;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (flow_context->type != 9 &&
|
if (flow_context->type != 9 &&
|
||||||
@@ -2479,8 +2474,7 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new = g_malloc0(sizeof(*new));
|
ngroup = g_malloc0(sizeof(*ngroup));
|
||||||
ngroup = new->value = g_malloc0(sizeof(*ngroup));
|
|
||||||
|
|
||||||
ngroup->id = group->id;
|
ngroup->id = group->id;
|
||||||
|
|
||||||
@@ -2525,10 +2519,7 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
|
|||||||
ngroup->index = ROCKER_GROUP_INDEX_GET(group->id);
|
ngroup->index = ROCKER_GROUP_INDEX_GET(group->id);
|
||||||
for (i = 0; i < group->l2_flood.group_count; i++) {
|
for (i = 0; i < group->l2_flood.group_count; i++) {
|
||||||
ngroup->has_group_ids = true;
|
ngroup->has_group_ids = true;
|
||||||
id = g_malloc0(sizeof(*id));
|
QAPI_LIST_PREPEND(ngroup->group_ids, group->l2_flood.group_ids[i]);
|
||||||
id->value = group->l2_flood.group_ids[i];
|
|
||||||
id->next = ngroup->group_ids;
|
|
||||||
ngroup->group_ids = id;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROCKER_OF_DPA_GROUP_TYPE_L3_UCAST:
|
case ROCKER_OF_DPA_GROUP_TYPE_L3_UCAST:
|
||||||
@@ -2557,8 +2548,7 @@ static void of_dpa_group_fill(void *key, void *value, void *user_data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
new->next = flow_context->list;
|
QAPI_LIST_PREPEND(flow_context->list, ngroup);
|
||||||
flow_context->list = new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RockerOfDpaGroupList *qmp_query_rocker_of_dpa_groups(const char *name,
|
RockerOfDpaGroupList *qmp_query_rocker_of_dpa_groups(const char *name,
|
||||||
|
|||||||
+7
-14
@@ -437,17 +437,14 @@ static void rxfilter_notify(NetClientState *nc)
|
|||||||
|
|
||||||
static intList *get_vlan_table(VirtIONet *n)
|
static intList *get_vlan_table(VirtIONet *n)
|
||||||
{
|
{
|
||||||
intList *list, *entry;
|
intList *list;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
for (i = 0; i < MAX_VLAN >> 5; i++) {
|
for (i = 0; i < MAX_VLAN >> 5; i++) {
|
||||||
for (j = 0; n->vlans[i] && j <= 0x1f; j++) {
|
for (j = 0; n->vlans[i] && j <= 0x1f; j++) {
|
||||||
if (n->vlans[i] & (1U << j)) {
|
if (n->vlans[i] & (1U << j)) {
|
||||||
entry = g_malloc0(sizeof(*entry));
|
QAPI_LIST_PREPEND(list, (i << 5) + j);
|
||||||
entry->value = (i << 5) + j;
|
|
||||||
entry->next = list;
|
|
||||||
list = entry;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -460,7 +457,7 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
|
|||||||
VirtIONet *n = qemu_get_nic_opaque(nc);
|
VirtIONet *n = qemu_get_nic_opaque(nc);
|
||||||
VirtIODevice *vdev = VIRTIO_DEVICE(n);
|
VirtIODevice *vdev = VIRTIO_DEVICE(n);
|
||||||
RxFilterInfo *info;
|
RxFilterInfo *info;
|
||||||
strList *str_list, *entry;
|
strList *str_list;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
info = g_malloc0(sizeof(*info));
|
info = g_malloc0(sizeof(*info));
|
||||||
@@ -491,19 +488,15 @@ static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc)
|
|||||||
|
|
||||||
str_list = NULL;
|
str_list = NULL;
|
||||||
for (i = 0; i < n->mac_table.first_multi; i++) {
|
for (i = 0; i < n->mac_table.first_multi; i++) {
|
||||||
entry = g_malloc0(sizeof(*entry));
|
QAPI_LIST_PREPEND(str_list,
|
||||||
entry->value = qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN);
|
qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN));
|
||||||
entry->next = str_list;
|
|
||||||
str_list = entry;
|
|
||||||
}
|
}
|
||||||
info->unicast_table = str_list;
|
info->unicast_table = str_list;
|
||||||
|
|
||||||
str_list = NULL;
|
str_list = NULL;
|
||||||
for (i = n->mac_table.first_multi; i < n->mac_table.in_use; i++) {
|
for (i = n->mac_table.first_multi; i < n->mac_table.in_use; i++) {
|
||||||
entry = g_malloc0(sizeof(*entry));
|
QAPI_LIST_PREPEND(str_list,
|
||||||
entry->value = qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN);
|
qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN));
|
||||||
entry->next = str_list;
|
|
||||||
str_list = entry;
|
|
||||||
}
|
}
|
||||||
info->multicast_table = str_list;
|
info->multicast_table = str_list;
|
||||||
info->vlan_table = get_vlan_table(n);
|
info->vlan_table = get_vlan_table(n);
|
||||||
|
|||||||
@@ -406,12 +406,9 @@ int migration_incoming_enable_colo(void)
|
|||||||
void migrate_add_address(SocketAddress *address)
|
void migrate_add_address(SocketAddress *address)
|
||||||
{
|
{
|
||||||
MigrationIncomingState *mis = migration_incoming_get_current();
|
MigrationIncomingState *mis = migration_incoming_get_current();
|
||||||
SocketAddressList *addrs;
|
|
||||||
|
|
||||||
addrs = g_new0(SocketAddressList, 1);
|
QAPI_LIST_PREPEND(mis->socket_address_list,
|
||||||
addrs->next = mis->socket_address_list;
|
QAPI_CLONE(SocketAddress, address));
|
||||||
mis->socket_address_list = addrs;
|
|
||||||
addrs->value = QAPI_CLONE(SocketAddress, address);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qemu_start_incoming_migration(const char *uri, Error **errp)
|
static void qemu_start_incoming_migration(const char *uri, Error **errp)
|
||||||
|
|||||||
@@ -145,14 +145,11 @@ static struct PostcopyBlocktimeContext *blocktime_context_new(void)
|
|||||||
static uint32List *get_vcpu_blocktime_list(PostcopyBlocktimeContext *ctx)
|
static uint32List *get_vcpu_blocktime_list(PostcopyBlocktimeContext *ctx)
|
||||||
{
|
{
|
||||||
MachineState *ms = MACHINE(qdev_get_machine());
|
MachineState *ms = MACHINE(qdev_get_machine());
|
||||||
uint32List *list = NULL, *entry = NULL;
|
uint32List *list = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = ms->smp.cpus - 1; i >= 0; i--) {
|
for (i = ms->smp.cpus - 1; i >= 0; i--) {
|
||||||
entry = g_new0(uint32List, 1);
|
QAPI_LIST_PREPEND(list, ctx->vcpu_blocktime[i]);
|
||||||
entry->value = ctx->vcpu_blocktime[i];
|
|
||||||
entry->next = list;
|
|
||||||
list = entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
+7
-6
@@ -1255,7 +1255,8 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
|
|||||||
const char *cap = qdict_get_str(qdict, "capability");
|
const char *cap = qdict_get_str(qdict, "capability");
|
||||||
bool state = qdict_get_bool(qdict, "state");
|
bool state = qdict_get_bool(qdict, "state");
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
MigrationCapabilityStatusList *caps = g_malloc0(sizeof(*caps));
|
MigrationCapabilityStatusList *caps = NULL;
|
||||||
|
MigrationCapabilityStatus *value;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
val = qapi_enum_parse(&MigrationCapability_lookup, cap, -1, &err);
|
val = qapi_enum_parse(&MigrationCapability_lookup, cap, -1, &err);
|
||||||
@@ -1263,14 +1264,14 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
caps->value = g_malloc0(sizeof(*caps->value));
|
value = g_malloc0(sizeof(*value));
|
||||||
caps->value->capability = val;
|
value->capability = val;
|
||||||
caps->value->state = state;
|
value->state = state;
|
||||||
caps->next = NULL;
|
QAPI_LIST_PREPEND(caps, value);
|
||||||
qmp_migrate_set_capabilities(caps, &err);
|
qmp_migrate_set_capabilities(caps, &err);
|
||||||
|
qapi_free_MigrationCapabilityStatusList(caps);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
qapi_free_MigrationCapabilityStatusList(caps);
|
|
||||||
hmp_handle_error(mon, err);
|
hmp_handle_error(mon, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-16
@@ -1430,33 +1430,26 @@ FdsetInfoList *qmp_query_fdsets(Error **errp)
|
|||||||
|
|
||||||
QEMU_LOCK_GUARD(&mon_fdsets_lock);
|
QEMU_LOCK_GUARD(&mon_fdsets_lock);
|
||||||
QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
|
QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
|
||||||
FdsetInfoList *fdset_info = g_malloc0(sizeof(*fdset_info));
|
FdsetInfo *fdset_info = g_malloc0(sizeof(*fdset_info));
|
||||||
FdsetFdInfoList *fdsetfd_list = NULL;
|
|
||||||
|
|
||||||
fdset_info->value = g_malloc0(sizeof(*fdset_info->value));
|
fdset_info->fdset_id = mon_fdset->id;
|
||||||
fdset_info->value->fdset_id = mon_fdset->id;
|
|
||||||
|
|
||||||
QLIST_FOREACH(mon_fdset_fd, &mon_fdset->fds, next) {
|
QLIST_FOREACH(mon_fdset_fd, &mon_fdset->fds, next) {
|
||||||
FdsetFdInfoList *fdsetfd_info;
|
FdsetFdInfo *fdsetfd_info;
|
||||||
|
|
||||||
fdsetfd_info = g_malloc0(sizeof(*fdsetfd_info));
|
fdsetfd_info = g_malloc0(sizeof(*fdsetfd_info));
|
||||||
fdsetfd_info->value = g_malloc0(sizeof(*fdsetfd_info->value));
|
fdsetfd_info->fd = mon_fdset_fd->fd;
|
||||||
fdsetfd_info->value->fd = mon_fdset_fd->fd;
|
|
||||||
if (mon_fdset_fd->opaque) {
|
if (mon_fdset_fd->opaque) {
|
||||||
fdsetfd_info->value->has_opaque = true;
|
fdsetfd_info->has_opaque = true;
|
||||||
fdsetfd_info->value->opaque = g_strdup(mon_fdset_fd->opaque);
|
fdsetfd_info->opaque = g_strdup(mon_fdset_fd->opaque);
|
||||||
} else {
|
} else {
|
||||||
fdsetfd_info->value->has_opaque = false;
|
fdsetfd_info->has_opaque = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fdsetfd_info->next = fdsetfd_list;
|
QAPI_LIST_PREPEND(fdset_info->fds, fdsetfd_info);
|
||||||
fdsetfd_list = fdsetfd_info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fdset_info->value->fds = fdsetfd_list;
|
QAPI_LIST_PREPEND(fdset_list, fdset_info);
|
||||||
|
|
||||||
fdset_info->next = fdset_list;
|
|
||||||
fdset_list = fdset_info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fdset_list;
|
return fdset_list;
|
||||||
|
|||||||
@@ -138,18 +138,18 @@ EventInfoList *qmp_query_events(Error **errp)
|
|||||||
* QAPIEvent_str() and QAPIEvent_lookup[]. When the command goes,
|
* QAPIEvent_str() and QAPIEvent_lookup[]. When the command goes,
|
||||||
* they should go, too.
|
* they should go, too.
|
||||||
*/
|
*/
|
||||||
EventInfoList *info, *ev_list = NULL;
|
EventInfoList *ev_list = NULL;
|
||||||
QAPIEvent e;
|
QAPIEvent e;
|
||||||
|
|
||||||
for (e = 0 ; e < QAPI_EVENT__MAX ; e++) {
|
for (e = 0 ; e < QAPI_EVENT__MAX ; e++) {
|
||||||
const char *event_name = QAPIEvent_str(e);
|
const char *event_name = QAPIEvent_str(e);
|
||||||
|
EventInfo *info;
|
||||||
|
|
||||||
assert(event_name != NULL);
|
assert(event_name != NULL);
|
||||||
info = g_malloc0(sizeof(*info));
|
info = g_malloc0(sizeof(*info));
|
||||||
info->value = g_malloc0(sizeof(*info->value));
|
info->name = g_strdup(event_name);
|
||||||
info->value->name = g_strdup(event_name);
|
|
||||||
|
|
||||||
info->next = ev_list;
|
QAPI_LIST_PREPEND(ev_list, info);
|
||||||
ev_list = info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ev_list;
|
return ev_list;
|
||||||
|
|||||||
+2
-3
@@ -1652,14 +1652,13 @@ static void do_dirty_bitmap_merge(const char *dst_node, const char *dst_name,
|
|||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
BlockDirtyBitmapMergeSource *merge_src;
|
BlockDirtyBitmapMergeSource *merge_src;
|
||||||
BlockDirtyBitmapMergeSourceList *list;
|
BlockDirtyBitmapMergeSourceList *list = NULL;
|
||||||
|
|
||||||
merge_src = g_new0(BlockDirtyBitmapMergeSource, 1);
|
merge_src = g_new0(BlockDirtyBitmapMergeSource, 1);
|
||||||
merge_src->type = QTYPE_QDICT;
|
merge_src->type = QTYPE_QDICT;
|
||||||
merge_src->u.external.node = g_strdup(src_node);
|
merge_src->u.external.node = g_strdup(src_node);
|
||||||
merge_src->u.external.name = g_strdup(src_name);
|
merge_src->u.external.name = g_strdup(src_name);
|
||||||
list = g_new0(BlockDirtyBitmapMergeSourceList, 1);
|
QAPI_LIST_PREPEND(list, merge_src);
|
||||||
list->value = merge_src;
|
|
||||||
qmp_block_dirty_bitmap_merge(dst_node, dst_name, list, errp);
|
qmp_block_dirty_bitmap_merge(dst_node, dst_name, list, errp);
|
||||||
qapi_free_BlockDirtyBitmapMergeSourceList(list);
|
qapi_free_BlockDirtyBitmapMergeSourceList(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,17 +293,12 @@ qmp_guest_ssh_get_authorized_keys(const char *username, Error **errp)
|
|||||||
|
|
||||||
ret = g_new0(GuestAuthorizedKeys, 1);
|
ret = g_new0(GuestAuthorizedKeys, 1);
|
||||||
for (i = 0; authkeys[i] != NULL; i++) {
|
for (i = 0; authkeys[i] != NULL; i++) {
|
||||||
strList *new;
|
|
||||||
|
|
||||||
g_strstrip(authkeys[i]);
|
g_strstrip(authkeys[i]);
|
||||||
if (!authkeys[i][0] || authkeys[i][0] == '#') {
|
if (!authkeys[i][0] || authkeys[i][0] == '#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new = g_new0(strList, 1);
|
QAPI_LIST_PREPEND(ret->keys, g_strdup(authkeys[i]));
|
||||||
new->value = g_strdup(authkeys[i]);
|
|
||||||
new->next = ret->keys;
|
|
||||||
ret->keys = new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_steal_pointer(&ret);
|
return g_steal_pointer(&ret);
|
||||||
|
|||||||
+11
-36
@@ -1036,7 +1036,6 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,
|
|||||||
{
|
{
|
||||||
GuestDiskAddress *disk;
|
GuestDiskAddress *disk;
|
||||||
GuestPCIAddress *pciaddr;
|
GuestPCIAddress *pciaddr;
|
||||||
GuestDiskAddressList *list = NULL;
|
|
||||||
bool has_hwinf;
|
bool has_hwinf;
|
||||||
#ifdef CONFIG_LIBUDEV
|
#ifdef CONFIG_LIBUDEV
|
||||||
struct udev *udev = NULL;
|
struct udev *udev = NULL;
|
||||||
@@ -1053,9 +1052,6 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,
|
|||||||
disk->pci_controller = pciaddr;
|
disk->pci_controller = pciaddr;
|
||||||
disk->bus_type = GUEST_DISK_BUS_TYPE_UNKNOWN;
|
disk->bus_type = GUEST_DISK_BUS_TYPE_UNKNOWN;
|
||||||
|
|
||||||
list = g_new0(GuestDiskAddressList, 1);
|
|
||||||
list->value = disk;
|
|
||||||
|
|
||||||
#ifdef CONFIG_LIBUDEV
|
#ifdef CONFIG_LIBUDEV
|
||||||
udev = udev_new();
|
udev = udev_new();
|
||||||
udevice = udev_device_new_from_syspath(udev, syspath);
|
udevice = udev_device_new_from_syspath(udev, syspath);
|
||||||
@@ -1089,10 +1085,9 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (has_hwinf || disk->has_dev || disk->has_serial) {
|
if (has_hwinf || disk->has_dev || disk->has_serial) {
|
||||||
list->next = fs->disk;
|
QAPI_LIST_PREPEND(fs->disk, disk);
|
||||||
fs->disk = list;
|
|
||||||
} else {
|
} else {
|
||||||
qapi_free_GuestDiskAddressList(list);
|
qapi_free_GuestDiskAddress(disk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1288,7 +1283,6 @@ static void get_disk_deps(const char *disk_dir, GuestDiskInfo *disk)
|
|||||||
disk->has_dependencies = true;
|
disk->has_dependencies = true;
|
||||||
while ((dep = g_dir_read_name(dp_deps)) != NULL) {
|
while ((dep = g_dir_read_name(dp_deps)) != NULL) {
|
||||||
g_autofree char *dep_dir = NULL;
|
g_autofree char *dep_dir = NULL;
|
||||||
strList *dep_item = NULL;
|
|
||||||
char *dev_name;
|
char *dev_name;
|
||||||
|
|
||||||
/* Add dependent disks */
|
/* Add dependent disks */
|
||||||
@@ -1296,10 +1290,7 @@ static void get_disk_deps(const char *disk_dir, GuestDiskInfo *disk)
|
|||||||
dev_name = get_device_for_syspath(dep_dir);
|
dev_name = get_device_for_syspath(dep_dir);
|
||||||
if (dev_name != NULL) {
|
if (dev_name != NULL) {
|
||||||
g_debug(" adding dependent device: %s", dev_name);
|
g_debug(" adding dependent device: %s", dev_name);
|
||||||
dep_item = g_new0(strList, 1);
|
QAPI_LIST_PREPEND(disk->dependencies, dev_name);
|
||||||
dep_item->value = dev_name;
|
|
||||||
dep_item->next = disk->dependencies;
|
|
||||||
disk->dependencies = dep_item;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_dir_close(dp_deps);
|
g_dir_close(dp_deps);
|
||||||
@@ -1318,7 +1309,7 @@ static GuestDiskInfoList *get_disk_partitions(
|
|||||||
const char *disk_name, const char *disk_dir,
|
const char *disk_name, const char *disk_dir,
|
||||||
const char *disk_dev)
|
const char *disk_dev)
|
||||||
{
|
{
|
||||||
GuestDiskInfoList *item, *ret = list;
|
GuestDiskInfoList *ret = list;
|
||||||
struct dirent *de_disk;
|
struct dirent *de_disk;
|
||||||
DIR *dp_disk = NULL;
|
DIR *dp_disk = NULL;
|
||||||
size_t len = strlen(disk_name);
|
size_t len = strlen(disk_name);
|
||||||
@@ -1352,15 +1343,9 @@ static GuestDiskInfoList *get_disk_partitions(
|
|||||||
partition->name = dev_name;
|
partition->name = dev_name;
|
||||||
partition->partition = true;
|
partition->partition = true;
|
||||||
/* Add parent disk as dependent for easier tracking of hierarchy */
|
/* Add parent disk as dependent for easier tracking of hierarchy */
|
||||||
partition->dependencies = g_new0(strList, 1);
|
QAPI_LIST_PREPEND(partition->dependencies, g_strdup(disk_dev));
|
||||||
partition->dependencies->value = g_strdup(disk_dev);
|
|
||||||
partition->has_dependencies = true;
|
|
||||||
|
|
||||||
item = g_new0(GuestDiskInfoList, 1);
|
|
||||||
item->value = partition;
|
|
||||||
item->next = ret;
|
|
||||||
ret = item;
|
|
||||||
|
|
||||||
|
QAPI_LIST_PREPEND(ret, partition);
|
||||||
}
|
}
|
||||||
closedir(dp_disk);
|
closedir(dp_disk);
|
||||||
|
|
||||||
@@ -1369,7 +1354,7 @@ static GuestDiskInfoList *get_disk_partitions(
|
|||||||
|
|
||||||
GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
||||||
{
|
{
|
||||||
GuestDiskInfoList *item, *ret = NULL;
|
GuestDiskInfoList *ret = NULL;
|
||||||
GuestDiskInfo *disk;
|
GuestDiskInfo *disk;
|
||||||
DIR *dp = NULL;
|
DIR *dp = NULL;
|
||||||
struct dirent *de = NULL;
|
struct dirent *de = NULL;
|
||||||
@@ -1415,10 +1400,7 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
|||||||
disk->partition = false;
|
disk->partition = false;
|
||||||
disk->alias = get_alias_for_syspath(disk_dir);
|
disk->alias = get_alias_for_syspath(disk_dir);
|
||||||
disk->has_alias = (disk->alias != NULL);
|
disk->has_alias = (disk->alias != NULL);
|
||||||
item = g_new0(GuestDiskInfoList, 1);
|
QAPI_LIST_PREPEND(ret, disk);
|
||||||
item->value = disk;
|
|
||||||
item->next = ret;
|
|
||||||
ret = item;
|
|
||||||
|
|
||||||
/* Get address for non-virtual devices */
|
/* Get address for non-virtual devices */
|
||||||
bool is_virtual = is_disk_virtual(disk_dir, &local_err);
|
bool is_virtual = is_disk_virtual(disk_dir, &local_err);
|
||||||
@@ -1495,7 +1477,7 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
|||||||
{
|
{
|
||||||
FsMountList mounts;
|
FsMountList mounts;
|
||||||
struct FsMount *mount;
|
struct FsMount *mount;
|
||||||
GuestFilesystemInfoList *new, *ret = NULL;
|
GuestFilesystemInfoList *ret = NULL;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
QTAILQ_INIT(&mounts);
|
QTAILQ_INIT(&mounts);
|
||||||
@@ -1508,10 +1490,7 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
|||||||
QTAILQ_FOREACH(mount, &mounts, next) {
|
QTAILQ_FOREACH(mount, &mounts, next) {
|
||||||
g_debug("Building guest fsinfo for '%s'", mount->dirname);
|
g_debug("Building guest fsinfo for '%s'", mount->dirname);
|
||||||
|
|
||||||
new = g_malloc0(sizeof(*ret));
|
QAPI_LIST_PREPEND(ret, build_guest_fsinfo(mount, &local_err));
|
||||||
new->value = build_guest_fsinfo(mount, &local_err);
|
|
||||||
new->next = ret;
|
|
||||||
ret = new;
|
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
qapi_free_GuestFilesystemInfoList(ret);
|
qapi_free_GuestFilesystemInfoList(ret);
|
||||||
@@ -1777,7 +1756,6 @@ GuestFilesystemTrimResponse *
|
|||||||
qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||||
{
|
{
|
||||||
GuestFilesystemTrimResponse *response;
|
GuestFilesystemTrimResponse *response;
|
||||||
GuestFilesystemTrimResultList *list;
|
|
||||||
GuestFilesystemTrimResult *result;
|
GuestFilesystemTrimResult *result;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
FsMountList mounts;
|
FsMountList mounts;
|
||||||
@@ -1801,10 +1779,7 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
|||||||
result = g_malloc0(sizeof(*result));
|
result = g_malloc0(sizeof(*result));
|
||||||
result->path = g_strdup(mount->dirname);
|
result->path = g_strdup(mount->dirname);
|
||||||
|
|
||||||
list = g_malloc0(sizeof(*list));
|
QAPI_LIST_PREPEND(response->paths, result);
|
||||||
list->value = result;
|
|
||||||
list->next = response->paths;
|
|
||||||
response->paths = list;
|
|
||||||
|
|
||||||
fd = qemu_open_old(mount->dirname, O_RDONLY);
|
fd = qemu_open_old(mount->dirname, O_RDONLY);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
|
|||||||
+8
-24
@@ -874,7 +874,7 @@ err_close:
|
|||||||
static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
|
static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
|
||||||
{
|
{
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
GuestDiskAddressList *list = NULL, *cur_item = NULL;
|
GuestDiskAddressList *list = NULL;
|
||||||
GuestDiskAddress *disk = NULL;
|
GuestDiskAddress *disk = NULL;
|
||||||
int i;
|
int i;
|
||||||
HANDLE vol_h;
|
HANDLE vol_h;
|
||||||
@@ -926,10 +926,8 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
|
|||||||
error_free(local_err);
|
error_free(local_err);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
list = g_malloc0(sizeof(*list));
|
QAPI_LIST_PREPEND(list, disk);
|
||||||
list->value = disk;
|
|
||||||
disk = NULL;
|
disk = NULL;
|
||||||
list->next = NULL;
|
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
error_setg_win32(errp, GetLastError(),
|
error_setg_win32(errp, GetLastError(),
|
||||||
@@ -960,11 +958,8 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
|
|||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
cur_item = g_malloc0(sizeof(*list));
|
QAPI_LIST_PREPEND(list, disk);
|
||||||
cur_item->value = disk;
|
|
||||||
disk = NULL;
|
disk = NULL;
|
||||||
cur_item->next = list;
|
|
||||||
list = cur_item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -982,7 +977,7 @@ out:
|
|||||||
GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
||||||
{
|
{
|
||||||
ERRP_GUARD();
|
ERRP_GUARD();
|
||||||
GuestDiskInfoList *new = NULL, *ret = NULL;
|
GuestDiskInfoList *ret = NULL;
|
||||||
HDEVINFO dev_info;
|
HDEVINFO dev_info;
|
||||||
SP_DEVICE_INTERFACE_DATA dev_iface_data;
|
SP_DEVICE_INTERFACE_DATA dev_iface_data;
|
||||||
int i;
|
int i;
|
||||||
@@ -1064,10 +1059,7 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
|||||||
disk->has_address = true;
|
disk->has_address = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
new = g_malloc0(sizeof(GuestDiskInfoList));
|
QAPI_LIST_PREPEND(ret, disk);
|
||||||
new->value = disk;
|
|
||||||
new->next = ret;
|
|
||||||
ret = new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(dev_info);
|
SetupDiDestroyDeviceInfoList(dev_info);
|
||||||
@@ -1165,7 +1157,7 @@ free:
|
|||||||
GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
||||||
{
|
{
|
||||||
HANDLE vol_h;
|
HANDLE vol_h;
|
||||||
GuestFilesystemInfoList *new, *ret = NULL;
|
GuestFilesystemInfoList *ret = NULL;
|
||||||
char guid[256];
|
char guid[256];
|
||||||
|
|
||||||
vol_h = FindFirstVolume(guid, sizeof(guid));
|
vol_h = FindFirstVolume(guid, sizeof(guid));
|
||||||
@@ -1183,10 +1175,7 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
|||||||
error_free(local_err);
|
error_free(local_err);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
new = g_malloc(sizeof(*ret));
|
QAPI_LIST_PREPEND(ret, info);
|
||||||
new->value = info;
|
|
||||||
new->next = ret;
|
|
||||||
ret = new;
|
|
||||||
} while (FindNextVolume(vol_h, guid, sizeof(guid)));
|
} while (FindNextVolume(vol_h, guid, sizeof(guid)));
|
||||||
|
|
||||||
if (GetLastError() != ERROR_NO_MORE_FILES) {
|
if (GetLastError() != ERROR_NO_MORE_FILES) {
|
||||||
@@ -1330,7 +1319,6 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
GuestFilesystemTrimResult *res;
|
GuestFilesystemTrimResult *res;
|
||||||
GuestFilesystemTrimResultList *list;
|
|
||||||
PWCHAR uc_path;
|
PWCHAR uc_path;
|
||||||
DWORD char_count = 0;
|
DWORD char_count = 0;
|
||||||
char *path, *out;
|
char *path, *out;
|
||||||
@@ -1369,11 +1357,7 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
|||||||
|
|
||||||
res->path = path;
|
res->path = path;
|
||||||
|
|
||||||
list = g_new0(GuestFilesystemTrimResultList, 1);
|
QAPI_LIST_PREPEND(resp->paths, res);
|
||||||
list->value = res;
|
|
||||||
list->next = resp->paths;
|
|
||||||
|
|
||||||
resp->paths = list;
|
|
||||||
|
|
||||||
memset(argv, 0, sizeof(argv));
|
memset(argv, 0, sizeof(argv));
|
||||||
argv[0] = (gchar *)"defrag.exe";
|
argv[0] = (gchar *)"defrag.exe";
|
||||||
|
|||||||
+1
-5
@@ -66,17 +66,13 @@ static void qmp_command_info(const QmpCommand *cmd, void *opaque)
|
|||||||
{
|
{
|
||||||
GuestAgentInfo *info = opaque;
|
GuestAgentInfo *info = opaque;
|
||||||
GuestAgentCommandInfo *cmd_info;
|
GuestAgentCommandInfo *cmd_info;
|
||||||
GuestAgentCommandInfoList *cmd_info_list;
|
|
||||||
|
|
||||||
cmd_info = g_new0(GuestAgentCommandInfo, 1);
|
cmd_info = g_new0(GuestAgentCommandInfo, 1);
|
||||||
cmd_info->name = g_strdup(qmp_command_name(cmd));
|
cmd_info->name = g_strdup(qmp_command_name(cmd));
|
||||||
cmd_info->enabled = qmp_command_is_enabled(cmd);
|
cmd_info->enabled = qmp_command_is_enabled(cmd);
|
||||||
cmd_info->success_response = qmp_has_success_response(cmd);
|
cmd_info->success_response = qmp_has_success_response(cmd);
|
||||||
|
|
||||||
cmd_info_list = g_new0(GuestAgentCommandInfoList, 1);
|
QAPI_LIST_PREPEND(info->supported_commands, cmd_info);
|
||||||
cmd_info_list->value = cmd_info;
|
|
||||||
cmd_info_list->next = info->supported_commands;
|
|
||||||
info->supported_commands = cmd_info_list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GuestAgentInfo *qmp_guest_info(Error **errp)
|
struct GuestAgentInfo *qmp_guest_info(Error **errp)
|
||||||
|
|||||||
+8
-21
@@ -46,14 +46,12 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
|
|||||||
|
|
||||||
object_property_iter_init(&iter, obj);
|
object_property_iter_init(&iter, obj);
|
||||||
while ((prop = object_property_iter_next(&iter))) {
|
while ((prop = object_property_iter_next(&iter))) {
|
||||||
ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry));
|
ObjectPropertyInfo *value = g_malloc0(sizeof(ObjectPropertyInfo));
|
||||||
|
|
||||||
entry->value = g_malloc0(sizeof(ObjectPropertyInfo));
|
QAPI_LIST_PREPEND(props, value);
|
||||||
entry->next = props;
|
|
||||||
props = entry;
|
|
||||||
|
|
||||||
entry->value->name = g_strdup(prop->name);
|
value->name = g_strdup(prop->name);
|
||||||
entry->value->type = g_strdup(prop->type);
|
value->type = g_strdup(prop->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return props;
|
return props;
|
||||||
@@ -90,7 +88,7 @@ QObject *qmp_qom_get(const char *path, const char *property, Error **errp)
|
|||||||
|
|
||||||
static void qom_list_types_tramp(ObjectClass *klass, void *data)
|
static void qom_list_types_tramp(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
ObjectTypeInfoList *e, **pret = data;
|
ObjectTypeInfoList **pret = data;
|
||||||
ObjectTypeInfo *info;
|
ObjectTypeInfo *info;
|
||||||
ObjectClass *parent = object_class_get_parent(klass);
|
ObjectClass *parent = object_class_get_parent(klass);
|
||||||
|
|
||||||
@@ -102,10 +100,7 @@ static void qom_list_types_tramp(ObjectClass *klass, void *data)
|
|||||||
info->parent = g_strdup(object_class_get_name(parent));
|
info->parent = g_strdup(object_class_get_name(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
e = g_malloc0(sizeof(*e));
|
QAPI_LIST_PREPEND(*pret, info);
|
||||||
e->value = info;
|
|
||||||
e->next = *pret;
|
|
||||||
*pret = e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
|
ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
|
||||||
@@ -150,7 +145,6 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
|
|||||||
object_property_iter_init(&iter, obj);
|
object_property_iter_init(&iter, obj);
|
||||||
while ((prop = object_property_iter_next(&iter))) {
|
while ((prop = object_property_iter_next(&iter))) {
|
||||||
ObjectPropertyInfo *info;
|
ObjectPropertyInfo *info;
|
||||||
ObjectPropertyInfoList *entry;
|
|
||||||
|
|
||||||
/* Skip Object and DeviceState properties */
|
/* Skip Object and DeviceState properties */
|
||||||
if (strcmp(prop->name, "type") == 0 ||
|
if (strcmp(prop->name, "type") == 0 ||
|
||||||
@@ -176,10 +170,7 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
|
|||||||
info->default_value = qobject_ref(prop->defval);
|
info->default_value = qobject_ref(prop->defval);
|
||||||
info->has_default_value = !!info->default_value;
|
info->has_default_value = !!info->default_value;
|
||||||
|
|
||||||
entry = g_malloc0(sizeof(*entry));
|
QAPI_LIST_PREPEND(prop_list, info);
|
||||||
entry->value = info;
|
|
||||||
entry->next = prop_list;
|
|
||||||
prop_list = entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object_unref(obj);
|
object_unref(obj);
|
||||||
@@ -217,7 +208,6 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
|
|||||||
}
|
}
|
||||||
while ((prop = object_property_iter_next(&iter))) {
|
while ((prop = object_property_iter_next(&iter))) {
|
||||||
ObjectPropertyInfo *info;
|
ObjectPropertyInfo *info;
|
||||||
ObjectPropertyInfoList *entry;
|
|
||||||
|
|
||||||
info = g_malloc0(sizeof(*info));
|
info = g_malloc0(sizeof(*info));
|
||||||
info->name = g_strdup(prop->name);
|
info->name = g_strdup(prop->name);
|
||||||
@@ -225,10 +215,7 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
|
|||||||
info->has_description = !!prop->description;
|
info->has_description = !!prop->description;
|
||||||
info->description = g_strdup(prop->description);
|
info->description = g_strdup(prop->description);
|
||||||
|
|
||||||
entry = g_malloc0(sizeof(*entry));
|
QAPI_LIST_PREPEND(prop_list, info);
|
||||||
entry->value = info;
|
|
||||||
entry->next = prop_list;
|
|
||||||
prop_list = entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object_unref(obj);
|
object_unref(obj);
|
||||||
|
|||||||
+1
-5
@@ -8283,7 +8283,6 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
|
|||||||
{
|
{
|
||||||
ObjectClass *oc = data;
|
ObjectClass *oc = data;
|
||||||
CpuDefinitionInfoList **cpu_list = user_data;
|
CpuDefinitionInfoList **cpu_list = user_data;
|
||||||
CpuDefinitionInfoList *entry;
|
|
||||||
CpuDefinitionInfo *info;
|
CpuDefinitionInfo *info;
|
||||||
const char *typename;
|
const char *typename;
|
||||||
|
|
||||||
@@ -8293,10 +8292,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
|
|||||||
strlen(typename) - strlen("-" TYPE_ARM_CPU));
|
strlen(typename) - strlen("-" TYPE_ARM_CPU));
|
||||||
info->q_typename = g_strdup(typename);
|
info->q_typename = g_strdup(typename);
|
||||||
|
|
||||||
entry = g_malloc0(sizeof(*entry));
|
QAPI_LIST_PREPEND(*cpu_list, info);
|
||||||
entry->value = info;
|
|
||||||
entry->next = *cpu_list;
|
|
||||||
*cpu_list = entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user