[PATCH 01/16] error: Add error_vprepend() in comment of ERRP_GUARD() rules

Zhao Liu posted 16 patches 9 months ago
Maintainers: Yi Liu <yi.l.liu@intel.com>, Eric Auger <eric.auger@redhat.com>, Zhenzhong Duan <zhenzhong.duan@intel.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, John Snow <jsnow@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>, Eric Blake <eblake@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Stefan Weil <sw@weilnetz.de>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony Perard <anthony.perard@citrix.com>, Paul Durrant <paul@xen.org>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Paul Burton <paulburton@kernel.org>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Markus Armbruster <armbru@redhat.com>, Michael Roth <michael.roth@amd.com>
There is a newer version of this series
[PATCH 01/16] error: Add error_vprepend() in comment of ERRP_GUARD() rules
Posted by Zhao Liu 9 months ago
From: Zhao Liu <zhao1.liu@intel.com>

The error_vprepend() should use ERRP_GUARD() just as the documentation
of ERRP_GUARD() says:

> It must be used when the function dereferences @errp or passes
> @errp to error_prepend(), error_vprepend(), or error_append_hint().

Considering that error_vprepend() is also an API provided in error.h,
it is necessary to add it to the description of the rules for using
ERRP_GUARD().

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 include/qapi/error.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/qapi/error.h b/include/qapi/error.h
index f21a231bb1a6..b1b389967f92 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -207,7 +207,7 @@
  *
  * Without ERRP_GUARD(), use of the @errp parameter is restricted:
  * - It must not be dereferenced, because it may be null.
- * - It should not be passed to error_prepend() or
+ * - It should not be passed to error_prepend(), error_vprepend() or
  *   error_append_hint(), because that doesn't work with &error_fatal.
  * ERRP_GUARD() lifts these restrictions.
  *
-- 
2.34.1
Re: [PATCH 01/16] error: Add error_vprepend() in comment of ERRP_GUARD() rules
Posted by Markus Armbruster 9 months ago
Zhao Liu <zhao1.liu@linux.intel.com> writes:

> From: Zhao Liu <zhao1.liu@intel.com>
>
> The error_vprepend() should use ERRP_GUARD() just as the documentation
> of ERRP_GUARD() says:
>
>> It must be used when the function dereferences @errp or passes
>> @errp to error_prepend(), error_vprepend(), or error_append_hint().
>
> Considering that error_vprepend() is also an API provided in error.h,
> it is necessary to add it to the description of the rules for using
> ERRP_GUARD().
>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>  include/qapi/error.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index f21a231bb1a6..b1b389967f92 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -207,7 +207,7 @@
>   *
>   * Without ERRP_GUARD(), use of the @errp parameter is restricted:
>   * - It must not be dereferenced, because it may be null.
> - * - It should not be passed to error_prepend() or
> + * - It should not be passed to error_prepend(), error_vprepend() or
>   *   error_append_hint(), because that doesn't work with &error_fatal.
>   * ERRP_GUARD() lifts these restrictions.
>   *

Good catch!

I'd like a comma after error_vprepend().

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Re: [PATCH 01/16] error: Add error_vprepend() in comment of ERRP_GUARD() rules
Posted by Zhao Liu 9 months ago
> >   * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> >   * - It must not be dereferenced, because it may be null.
> > - * - It should not be passed to error_prepend() or
> > + * - It should not be passed to error_prepend(), error_vprepend() or
> >   *   error_append_hint(), because that doesn't work with &error_fatal.
> >   * ERRP_GUARD() lifts these restrictions.
> >   *
> 
> Good catch!
> 
> I'd like a comma after error_vprepend().
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Thanks! I'll.

Regards,
Zhao