[libvirt] [PATCH v2 1/9] vbox: Add various vir*Flags API

Peter Krempa pkrempa at redhat.com
Wed Jul 10 07:02:42 UTC 2019


On Tue, Jul 09, 2019 at 12:46:30 -0500, Eric Blake wrote:
> Even though we don't accept any flags, it is unfriendly to callers
> that use the modern API to have to fall back to the flag-free API.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/vbox/vbox_common.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
> index 54e31bec9d..44c98cadf6 100644
> --- a/src/vbox/vbox_common.c
> +++ b/src/vbox/vbox_common.c
> @@ -553,7 +553,8 @@ static int vboxConnectClose(virConnectPtr conn)
>  }
> 
>  static int
> -vboxDomainSave(virDomainPtr dom, const char *path ATTRIBUTE_UNUSED)
> +vboxDomainSaveFlags(virDomainPtr dom, const char *path ATTRIBUTE_UNUSED,
> +                    const char *dxml, unsigned int flags)
>  {
>      vboxDriverPtr data = dom->conn->privateData;
>      IConsole *console = NULL;
> @@ -564,6 +565,9 @@ vboxDomainSave(virDomainPtr dom, const char *path ATTRIBUTE_UNUSED)
>      nsresult rc;
>      int ret = -1;
> 
> +    virCheckFlags(0, -1);
> +    virCheckNonNullArgReturn(dxml, -1);

This reports: invalid argument: dxml in vboxDomainSave must not be NULL

I'm not certain that the internal function name makes sense to external
users.

> +
>      if (!data->vboxObj)
>          return ret;
> 
> @@ -607,6 +611,12 @@ vboxDomainSave(virDomainPtr dom, const char *path ATTRIBUTE_UNUSED)
>      return ret;
>  }
> 
> +static int
> +vboxDomainSave(virDomainPtr dom, const char *path)
> +{
> +    return vboxDomainSaveFlags(dom, path, NULL, 0);

So, this passes NULL 'dxml' into vboxDomainSaveFlags which explicitly
rejects it. What's the point?

Ah I see. Was the above supposed to be virCheckNullArgGoto?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190710/0b7ef52c/attachment-0001.sig>


More information about the libvir-list mailing list