[libvirt] [PATCH 17/22] qemu: Use virTypedParamList in the bulk stats gathering functions

Ján Tomko jtomko at redhat.com
Tue Sep 24 16:57:08 UTC 2019


On Thu, Sep 19, 2019 at 07:13:20PM +0200, Peter Krempa wrote:
>The bulk stats functions are specific as they pass around the list into
>many sub-functions and also a substantial amount of the entries uses
>formatted names for indexing purposes. This makes them ideal to be
>converted to the new virTypedParamList helpers.
>
>Unfortunately given how the functions are used this requires a big-bang
>rewrite of all of the calls to add entries to the parameter list.
>
>Given that a substantial simplification is achieved as well as a prety

pretty

>significant change to the original code is required some macros which
>were used only sporradically were replaced by inline calls rather than

sporadically

>tweaking the macros first and deleting them later.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_driver.c | 472 ++++++++++++-----------------------------
> 1 file changed, 139 insertions(+), 333 deletions(-)
>

[...]

>-#define QEMU_ADD_BLOCK_PARAM_UI(record, maxparams, num, name, value) \

Now I see where those short type names came from.

>-    do { \
>-        char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \
>-        snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \
>-                 "block.%zu.%s", num, name); \
>-        if (virTypedParamsAddUInt(&(record)->params, \
>-                                  &(record)->nparams, \
>-                                  maxparams, \
>-                                  param_name, \
>-                                  value) < 0) \
>-            goto cleanup; \
>-    } while (0)
>-

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190924/69caebc4/attachment-0001.sig>


More information about the libvir-list mailing list