[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 02/11] error: auto propagated local_err


  • To: Paul Durrant <pdurrant@xxxxxxxxx>
  • From: Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx>
  • Date: Mon, 13 Jan 2020 09:25:36 +0000
  • Accept-language: ru-RU, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BbzY4gvzUbPHPBLORohLPBV5D0PEI6+b7bEhYVwZRdE=; b=K/G7JT9LV7r1Dw/gqabhk6+wZz0OxVPNbZySj8+K9QBUCm/QP/veGmWRKcwJncoZ50f6rNbLmkb7GFEW9/Q9247QGVMoPlhzCxrMdO05BHLNTGOfVabVefknzq1yB4QkztGd2VwgAwMvJeWrWyVw4XCxoElQy4V2Ilcnl9OrLCgbTaHHA+SlgXBGOyhXQAvaGyNAS0aCv+XnleniE6bUZbVtFhfyH+AX8Qwi52/5/ATWc50Qf6kRalm+Wlfttu0c2jEkDT/HjOdTMZqgIdD2L14yoQos0y3pCvBGl+MbgatJqgTIhm/iucbtkgzeTb/qHZl5ZCs+ER5m422UDIwvGw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n4sjrPIdei3FyMoPA+bBVmPXKk10h1mTEV7sgrrX8B5J7ym5bNuDS2wbnTzRGeLmCu0S5JijJSajfB6L1EJCQcnoMy2usPx6YSPF4H3d1F28gAs7AYgd5MvGUH6bFPKIDfxmAjXYIEcONT+c8NAQjdAKNNfyLfCQAbNWN6RX7atE3Y13hr2hrXOuanxGcXMVz49E9FKeAEycNlelT5wcDOb7HgHvLrLeANjGCg3GB7af8Evc+M5voakPSpER1Mcbaz0jLnMDV2VjR/xCDbiMoVWM25cp+58d+f06RETAxrZPrZR0o1N4m8+Ijq926B0GHejklnr1lHYgKd4g+hVKtQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vsementsov@xxxxxxxxxxxxx;
  • Cc: Kevin Wolf <kwolf@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Laszlo Ersek <lersek@xxxxxxxxxx>, "qemu-block@xxxxxxxxxx" <qemu-block@xxxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Greg Kurz <groug@xxxxxxxx>, "qemu-devel@xxxxxxxxxx" <qemu-devel@xxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Stefan Hajnoczi <stefanha@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Max Reitz <mreitz@xxxxxxxxxx>, Eric Blake <eblake@xxxxxxxxxx>, Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Stefan Berger <stefanb@xxxxxxxxxxxxx>
  • Delivery-date: Mon, 13 Jan 2020 09:26:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVx+4Rt2lsJ4uM40eLuOqM7f0+qKfoTRGAgAAJ4oA=
  • Thread-topic: [PATCH v6 02/11] error: auto propagated local_err

13.01.2020 11:50, Paul Durrant wrote:
> On Fri, 10 Jan 2020 at 19:42, Vladimir Sementsov-Ogievskiy
> <vsementsov@xxxxxxxxxxxxx> wrote:
> [snip]
>> +/*
>> + * ERRP_AUTO_PROPAGATE
>> + *
>> + * This macro is created to be the first line of a function which use
>> + * Error **errp parameter to report error. It's needed only in cases where 
>> we
>> + * want to use error_prepend, error_append_hint or dereference *errp. It's
>> + * still safe (but useless) in other cases.
>> + *
>> + * If errp is NULL or points to error_fatal, it is rewritten to point to a
>> + * local Error object, which will be automatically propagated to the 
>> original
>> + * errp on function exit (see error_propagator_cleanup).
>> + *
>> + * After invocation of this macro it is always safe to dereference errp
>> + * (as it's not NULL anymore) and to add information (by error_prepend or
>> + * error_append_hint)
>> + * (as, if it was error_fatal, we swapped it with a local_error to be
>> + * propagated on cleanup).
>> + *
>> + * Note: we don't wrap the error_abort case, as we want resulting coredump
>> + * to point to the place where the error happened, not to error_propagate.
>> + */
>> +#define ERRP_AUTO_PROPAGATE()                                  \
>> +    g_auto(ErrorPropagator) _auto_errp_prop = {.errp = errp};  \
>> +    errp = ((errp == NULL || *errp == error_fatal)             \
> 
> Perhaps !errp rather than errp == NULL, for brevity.
> 

I mostly prefer !ptr notation.. But may be here, I'd keep it as is,
to stress special-casing NULL in this non-trivial place.. And it is in good
relation with phrasing "If errp is NULL or points to error_fatal".
But !errp is OK for me to. Let it be as Markus prefer, he is maintainer.

> 
>> +            ? &_auto_errp_prop.local_err : errp)
>> +
>>   /*
>>    * Special error destination to abort on error.
>>    * See error_setg() and error_propagate() for details.
>> --
>> 2.21.0
>>


-- 
Best regards,
Vladimir
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.