|
From: | Eric Blake |
Subject: | Re: [Qemu-devel] [PATCH v3 1/3] qapi: add x-debug-query-block-graph |
Date: | Fri, 28 Sep 2018 11:39:46 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 9/28/18 11:31 AM, Max Reitz wrote:
On 23.08.18 17:46, Vladimir Sementsov-Ogievskiy wrote:Add a new command, returning block nodes (and their users) graph.
Drive-by comment without actually reading the patch yet:
+++ b/block.c @@ -4003,6 +4003,135 @@ BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp) return list; }+#define QAPI_LIST_ADD(list, element) do { \+ typeof(list) _tmp = g_new(typeof(*(list)), 1); \ + _tmp->value = (element); \ + _tmp->next = (list); \ + list = _tmp; \Interesting, how yoo put (list) as an rvalue in parentheses, but don't do so when it's an lvalue. :-) I can follow your line of thinking, but it should probably always be in parentheses.
This macro seems rather handy. How much else in the code base would benefit if we promote this into something officially provided by qapi code (probably in qlist.h) rather than making multiple callsites repeat the boilerplate?
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |