mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
QAPI patches patches for 2021-01-28
-----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmASY10SHGFybWJydUBy ZWRoYXQuY29tAAoJEDhwtADrkYZT4M4P+gKN64+WaErotLHHsqtiA0aoTwbTFXin OEyR5du0+PjX96qYHHV+ZDn5uxxKI57/SRNooPndjU63sYgAbNApfsu+wUDZC844 qMSlrmyw2+Lw1EIykoLXK49+pEDU0XpVIciL5+zEdtCgjiJRjrOOJ/JRBcKoQNHn UArGNQ8y0D+0i8uXyJjyvQeHdz6KUr9sX1vqwRGMt9axEMDJks0+Si4Zg3z2wlWJ Sc3WsXEhikxK1qkF2/6VsopOgNGB0UUvV6q1GO6ngdqag1Hb6mACzSv9mtIShGjh a2MISBhxF8h4wfO8U5TiS9vBgYR3elA3kRGsn4FOfD3sSilt/SWLPHWXdlO1aL2E TollRPtYBqn2YIYQP1SEp7NIqaWC/QaGkP/mH8Jvv0YlL64RK879lv6KiHKzfvI7 HBD7WGZBwMQqPczuw308tqDTQPKUsPDYoEJAFRywkLry86wL8DBOlkQ0lWUjF06s UQk/i09nhrcNLo0GbmgAOHUVj4m03zLyMW/fYmsQ8xe9/b6GBwJvtm2v5wKwg0HE ixxj4oBIk5YV5Xwt7DKLkT0voPAAgNK13a6ywzbyfsigwaJaO9tLtZ0PMuaT9kgs b/OBdeeIYpFdIT/DlcMWpIFi53VYe0McX8MmprHcMZb1133wk5Z5gk+FAWLMifrw 2ltmoUPoB1dC =djiE -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-01-28' into staging QAPI patches patches for 2021-01-28 # gpg: Signature made Thu 28 Jan 2021 07:10:21 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2021-01-28: qapi: More complex uses of QAPI_LIST_APPEND qapi: Use QAPI_LIST_APPEND in trivial cases qapi: Introduce QAPI_LIST_APPEND qapi: A couple more QAPI_LIST_PREPEND() stragglers net: Clarify early exit condition Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
7e7eb9f852
31 changed files with 267 additions and 551 deletions
|
@ -572,12 +572,12 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
|
|||
{
|
||||
BdrvDirtyBitmap *bm;
|
||||
BlockDirtyInfoList *list = NULL;
|
||||
BlockDirtyInfoList **plist = &list;
|
||||
BlockDirtyInfoList **tail = &list;
|
||||
|
||||
bdrv_dirty_bitmaps_lock(bs);
|
||||
QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) {
|
||||
BlockDirtyInfo *info = g_new0(BlockDirtyInfo, 1);
|
||||
BlockDirtyInfoList *entry = g_new0(BlockDirtyInfoList, 1);
|
||||
|
||||
info->count = bdrv_get_dirty_count(bm);
|
||||
info->granularity = bdrv_dirty_bitmap_granularity(bm);
|
||||
info->has_name = !!bm->name;
|
||||
|
@ -588,9 +588,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
|
|||
info->persistent = bm->persistent;
|
||||
info->has_inconsistent = bm->inconsistent;
|
||||
info->inconsistent = bm->inconsistent;
|
||||
entry->value = info;
|
||||
*plist = entry;
|
||||
plist = &entry->next;
|
||||
QAPI_LIST_APPEND(tail, info);
|
||||
}
|
||||
bdrv_dirty_bitmaps_unlock(bs);
|
||||
|
||||
|
|
|
@ -342,11 +342,10 @@ void qmp_block_export_del(const char *id,
|
|||
|
||||
BlockExportInfoList *qmp_query_block_exports(Error **errp)
|
||||
{
|
||||
BlockExportInfoList *head = NULL, **p_next = &head;
|
||||
BlockExportInfoList *head = NULL, **tail = &head;
|
||||
BlockExport *exp;
|
||||
|
||||
QLIST_FOREACH(exp, &block_exports, next) {
|
||||
BlockExportInfoList *entry = g_new0(BlockExportInfoList, 1);
|
||||
BlockExportInfo *info = g_new(BlockExportInfo, 1);
|
||||
*info = (BlockExportInfo) {
|
||||
.id = g_strdup(exp->id),
|
||||
|
@ -355,9 +354,7 @@ BlockExportInfoList *qmp_query_block_exports(Error **errp)
|
|||
.shutting_down = !exp->user_owned,
|
||||
};
|
||||
|
||||
entry->value = info;
|
||||
*p_next = entry;
|
||||
p_next = &entry->next;
|
||||
QAPI_LIST_APPEND(tail, info);
|
||||
}
|
||||
|
||||
return head;
|
||||
|
|
|
@ -514,7 +514,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
|
|||
{
|
||||
QemuOpts *opts;
|
||||
SocketAddress *gsconf = NULL;
|
||||
SocketAddressList *curr = NULL;
|
||||
SocketAddressList **tail;
|
||||
QDict *backing_options = NULL;
|
||||
Error *local_err = NULL;
|
||||
char *str = NULL;
|
||||
|
@ -547,6 +547,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
|
|||
}
|
||||
gconf->path = g_strdup(ptr);
|
||||
qemu_opts_del(opts);
|
||||
tail = &gconf->server;
|
||||
|
||||
for (i = 0; i < num_servers; i++) {
|
||||
str = g_strdup_printf(GLUSTER_OPT_SERVER_PATTERN"%d.", i);
|
||||
|
@ -655,15 +656,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
|
|||
qemu_opts_del(opts);
|
||||
}
|
||||
|
||||
if (gconf->server == NULL) {
|
||||
gconf->server = g_new0(SocketAddressList, 1);
|
||||
gconf->server->value = gsconf;
|
||||
curr = gconf->server;
|
||||
} else {
|
||||
curr->next = g_new0(SocketAddressList, 1);
|
||||
curr->next->value = gsconf;
|
||||
curr = curr->next;
|
||||
}
|
||||
QAPI_LIST_APPEND(tail, gsconf);
|
||||
gsconf = NULL;
|
||||
|
||||
qobject_unref(backing_options);
|
||||
|
|
37
block/qapi.c
37
block/qapi.c
|
@ -198,7 +198,7 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs,
|
|||
{
|
||||
int i, sn_count;
|
||||
QEMUSnapshotInfo *sn_tab = NULL;
|
||||
SnapshotInfoList *info_list, *cur_item = NULL, *head = NULL;
|
||||
SnapshotInfoList *head = NULL, **tail = &head;
|
||||
SnapshotInfo *info;
|
||||
|
||||
sn_count = bdrv_snapshot_list(bs, &sn_tab);
|
||||
|
@ -233,17 +233,7 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs,
|
|||
info->icount = sn_tab[i].icount;
|
||||
info->has_icount = sn_tab[i].icount != -1ULL;
|
||||
|
||||
info_list = g_new0(SnapshotInfoList, 1);
|
||||
info_list->value = info;
|
||||
|
||||
/* XXX: waiting for the qapi to support qemu-queue.h types */
|
||||
if (!cur_item) {
|
||||
head = cur_item = info_list;
|
||||
} else {
|
||||
cur_item->next = info_list;
|
||||
cur_item = info_list;
|
||||
}
|
||||
|
||||
QAPI_LIST_APPEND(tail, info);
|
||||
}
|
||||
|
||||
g_free(sn_tab);
|
||||
|
@ -418,17 +408,12 @@ static uint64List *uint64_list(uint64_t *list, int size)
|
|||
{
|
||||
int i;
|
||||
uint64List *out_list = NULL;
|
||||
uint64List **pout_list = &out_list;
|
||||
uint64List **tail = &out_list;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
uint64List *entry = g_new(uint64List, 1);
|
||||
entry->value = list[i];
|
||||
*pout_list = entry;
|
||||
pout_list = &entry->next;
|
||||
QAPI_LIST_APPEND(tail, list[i]);
|
||||
}
|
||||
|
||||
*pout_list = NULL;
|
||||
|
||||
return out_list;
|
||||
}
|
||||
|
||||
|
@ -636,26 +621,21 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
|
|||
bool query_nodes,
|
||||
Error **errp)
|
||||
{
|
||||
BlockStatsList *head = NULL, **p_next = &head;
|
||||
BlockStatsList *head = NULL, **tail = &head;
|
||||
BlockBackend *blk;
|
||||
BlockDriverState *bs;
|
||||
|
||||
/* Just to be safe if query_nodes is not always initialized */
|
||||
if (has_query_nodes && query_nodes) {
|
||||
for (bs = bdrv_next_node(NULL); bs; bs = bdrv_next_node(bs)) {
|
||||
BlockStatsList *info = g_malloc0(sizeof(*info));
|
||||
AioContext *ctx = bdrv_get_aio_context(bs);
|
||||
|
||||
aio_context_acquire(ctx);
|
||||
info->value = bdrv_query_bds_stats(bs, false);
|
||||
QAPI_LIST_APPEND(tail, bdrv_query_bds_stats(bs, false));
|
||||
aio_context_release(ctx);
|
||||
|
||||
*p_next = info;
|
||||
p_next = &info->next;
|
||||
}
|
||||
} else {
|
||||
for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
|
||||
BlockStatsList *info;
|
||||
AioContext *ctx = blk_get_aio_context(blk);
|
||||
BlockStats *s;
|
||||
char *qdev;
|
||||
|
@ -680,10 +660,7 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
|
|||
bdrv_query_blk_stats(s->stats, blk);
|
||||
aio_context_release(ctx);
|
||||
|
||||
info = g_malloc0(sizeof(*info));
|
||||
info->value = s;
|
||||
*p_next = info;
|
||||
p_next = &info->next;
|
||||
QAPI_LIST_APPEND(tail, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1061,7 +1061,7 @@ fail:
|
|||
static Qcow2BitmapInfoFlagsList *get_bitmap_info_flags(uint32_t flags)
|
||||
{
|
||||
Qcow2BitmapInfoFlagsList *list = NULL;
|
||||
Qcow2BitmapInfoFlagsList **plist = &list;
|
||||
Qcow2BitmapInfoFlagsList **tail = &list;
|
||||
int i;
|
||||
|
||||
static const struct {
|
||||
|
@ -1076,11 +1076,7 @@ static Qcow2BitmapInfoFlagsList *get_bitmap_info_flags(uint32_t flags)
|
|||
|
||||
for (i = 0; i < map_size; ++i) {
|
||||
if (flags & map[i].bme) {
|
||||
Qcow2BitmapInfoFlagsList *entry =
|
||||
g_new0(Qcow2BitmapInfoFlagsList, 1);
|
||||
entry->value = map[i].info;
|
||||
*plist = entry;
|
||||
plist = &entry->next;
|
||||
QAPI_LIST_APPEND(tail, map[i].info);
|
||||
flags &= ~map[i].bme;
|
||||
}
|
||||
}
|
||||
|
@ -1105,7 +1101,7 @@ Qcow2BitmapInfoList *qcow2_get_bitmap_info_list(BlockDriverState *bs,
|
|||
Qcow2BitmapList *bm_list;
|
||||
Qcow2Bitmap *bm;
|
||||
Qcow2BitmapInfoList *list = NULL;
|
||||
Qcow2BitmapInfoList **plist = &list;
|
||||
Qcow2BitmapInfoList **tail = &list;
|
||||
|
||||
if (s->nb_bitmaps == 0) {
|
||||
return NULL;
|
||||
|
@ -1119,13 +1115,10 @@ Qcow2BitmapInfoList *qcow2_get_bitmap_info_list(BlockDriverState *bs,
|
|||
|
||||
QSIMPLEQ_FOREACH(bm, bm_list, entry) {
|
||||
Qcow2BitmapInfo *info = g_new0(Qcow2BitmapInfo, 1);
|
||||
Qcow2BitmapInfoList *obj = g_new0(Qcow2BitmapInfoList, 1);
|
||||
info->granularity = 1U << bm->granularity_bits;
|
||||
info->name = g_strdup(bm->name);
|
||||
info->flags = get_bitmap_info_flags(bm->flags & ~BME_RESERVED_FLAGS);
|
||||
obj->value = info;
|
||||
*plist = obj;
|
||||
plist = &obj->next;
|
||||
QAPI_LIST_APPEND(tail, info);
|
||||
}
|
||||
|
||||
bitmap_list_free(bm_list);
|
||||
|
|
|
@ -2928,7 +2928,7 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs,
|
|||
int i;
|
||||
BDRVVmdkState *s = bs->opaque;
|
||||
ImageInfoSpecific *spec_info = g_new0(ImageInfoSpecific, 1);
|
||||
ImageInfoList **next;
|
||||
ImageInfoList **tail;
|
||||
|
||||
*spec_info = (ImageInfoSpecific){
|
||||
.type = IMAGE_INFO_SPECIFIC_KIND_VMDK,
|
||||
|
@ -2943,12 +2943,9 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs,
|
|||
.parent_cid = s->parent_cid,
|
||||
};
|
||||
|
||||
next = &spec_info->u.vmdk.data->extents;
|
||||
tail = &spec_info->u.vmdk.data->extents;
|
||||
for (i = 0; i < s->num_extents; i++) {
|
||||
*next = g_new0(ImageInfoList, 1);
|
||||
(*next)->value = vmdk_get_extent_info(&s->extents[i]);
|
||||
(*next)->next = NULL;
|
||||
next = &(*next)->next;
|
||||
QAPI_LIST_APPEND(tail, vmdk_get_extent_info(&s->extents[i]));
|
||||
}
|
||||
|
||||
return spec_info;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue