[PATCH] src: network_conf: propagate only bool to virNetworkDefParseString()
Michal Prívozník
mprivozn at redhat.com
Fri Sep 10 15:38:20 UTC 2021
On 9/10/21 4:48 PM, Kristina Hanicova wrote:
> We don't need to propagate all public flags, only the information
> about the presence of the validation one, which can differ from
> function to function. This patch makes it easier and more
> readable in case of a future additions of validation flags.
> This change was suggested by Daniel.
>
> Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
> ---
> src/conf/domain_conf.c | 2 +-
> src/conf/network_conf.c | 12 ++++++------
> src/conf/network_conf.h | 2 +-
> src/esx/esx_network_driver.c | 2 +-
> src/network/bridge_driver.c | 5 +++--
> src/qemu/qemu_process.c | 2 +-
> src/test/test_driver.c | 5 +++--
> src/vbox/vbox_network.c | 3 ++-
> 8 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index cb9e7218ff..858f6f923a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -30523,7 +30523,7 @@ virDomainNetResolveActualType(virDomainNetDef *iface)
> if (!(xml = virNetworkGetXMLDesc(net, 0)))
> goto cleanup;
>
> - if (!(def = virNetworkDefParseString(xml, NULL, 0)))
> + if (!(def = virNetworkDefParseString(xml, NULL, false)))
> goto cleanup;
>
> switch ((virNetworkForwardType) def->forward.type) {
> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
> index f23599abac..7a0f6f02c3 100644
> --- a/src/conf/network_conf.c
> +++ b/src/conf/network_conf.c
> @@ -318,7 +318,7 @@ virNetworkDefCopy(virNetworkDef *def,
> if (!(xml = virNetworkDefFormat(def, xmlopt, flags)))
> return NULL;
>
> - return virNetworkDefParseString(xml, xmlopt, 0);
> + return virNetworkDefParseString(xml, xmlopt, false);
> }
>
>
> @@ -2086,14 +2086,14 @@ static virNetworkDef *
> virNetworkDefParse(const char *xmlStr,
> const char *filename,
> virNetworkXMLOption *xmlopt,
> - unsigned int flags)
> + bool validate_flag)
I think we can call it just 'validate'.
And there are some other places where we are passing flags &
VIR_NETWORK_DEFINE_VALIDATE. Those should be fixed to !!(flags &
VIR_NETWORK_DEFINE_VALIDATE).
I'm fixing this patch per my suggestions and pushing.
Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
Michal
More information about the libvir-list
mailing list