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

Re: [PATCH v2] tools/libs/ctrl: Save errno only once in *PRINTF() and *ERROR()


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 9 Dec 2021 15:50:41 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0d1plSlWFWoRUgH6Y3v4RbPTTXNogkUNcjowDv6cRhE=; b=jIlGuM7V1n6Jo4wk0qLbm+GcUd2nCANC/HdV0eBmdPYBV4OsdcqbwswSpzMMo89/Lt6X6J7jiOcYXaHm4uDp26xq9SVIQkWfumLAmRofmxd3mi7PRAbwUNBLMRTGgo3mJhhk3KY0gRcS8ponKLkhOJQk9qzMkZwZwSNMlquraRTQEC5azNE/uX+t62cayc4WlnPVhZXGuN9ukLHaUPmx1ZTPp3nzdg+VEjaXJHsM8VV8bqfWET4o9o/ZDRKttFbk+XSDQW8Lui5OCSYRSLsRJZ9ekWdvER1mvOFnzVXTgmxqialPwK5p0nIz91RyEPgNom3GmnaLUMJ8hSCb+eyGSA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TJjXC/Sxv6lF35B7dI2Q4k9fyCD1jUPOuDcXyw4aqB+s0l5UdEQB6MTS5EDU6m6zFu+YROazBijKSV6KnXlsDQyCxffGGwqbMhQGmYgUWRcOhVRIHz2DDFIJ2cAN7E/i5pdYyHofaO7mEwD93F2FtgRGHjjcKnd/KjqJ0PnmtJBZsZfQdrKAIwufP2q9ruQSPQmtn75yZDMWUt1aGBw8DD5N70wNIcADavgRIFLagGHc90lbXH4Qt0jWzuWUXS64r+5XwVyYGcJHW7CULt4YPdEnljy8XI5NV4Tw20qTSPVGHQa+A28QVQZ1GDudkxWb005hztC9DhJtsIx7ue6okA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: anthony.perard@xxxxxxxxxx, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 09 Dec 2021 14:51:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.12.2021 14:40, Juergen Gross wrote:
> All *PRINTF() and *ERROR() macros are based on xc_reportv() which is
> saving and restoring errno in order to not modify it. There is no need
> to save and restore in those macros, too.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> V2:
> - style corrections (Jan Beulich)

Thanks. Sadly there still is ...

> --- a/tools/libs/ctrl/xc_private.h
> +++ b/tools/libs/ctrl/xc_private.h
> @@ -122,28 +122,18 @@ void xc_report_progress_step(xc_interface *xch,
>  
>  /* anamorphic macros:  struct xc_interface *xch  must be in scope */
>  
> -#define IPRINTF(_f, _a...)  do { int IPRINTF_errno = errno; \
> -        xc_report(xch, xch->error_handler, XTL_INFO,0, _f , ## _a); \
> -        errno = IPRINTF_errno; \
> -        } while (0)
> -#define DPRINTF(_f, _a...) do { int DPRINTF_errno = errno; \
> -        xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f , ## _a); \
> -        errno = DPRINTF_errno; \
> -        } while (0)
> -#define DBGPRINTF(_f, _a...)  do { int DBGPRINTF_errno = errno; \
> -        xc_report(xch, xch->error_handler, XTL_DEBUG,0, _f , ## _a); \
> -        errno = DBGPRINTF_errno; \
> -        } while (0)
> -
> -#define ERROR(_m, _a...)  do { int ERROR_errno = errno; \
> -        xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a ); \
> -        errno = ERROR_errno; \
> -        } while (0)
> -#define PERROR(_m, _a...) do { int PERROR_errno = errno; \
> -        xc_report_error(xch,XC_INTERNAL_ERROR,_m " (%d = %s)", \
> -        ## _a , errno, xc_strerror(xch, errno)); \
> -        errno = PERROR_errno; \
> -        } while (0)
> +#define IPRINTF(_f, _a...) \
> +        xc_report(xch, xch->error_handler, XTL_INFO, 0, _f, ## _a)
> +#define DPRINTF(_f, _a...) \
> +        xc_report(xch, xch->error_handler, XTL_DETAIL, 0, _f, ## _a)
> +#define DBGPRINTF(_f, _a...) \
> +        xc_report(xch, xch->error_handler, XTL_DEBUG, 0, _f, ## _a)
> +
> +#define ERROR(_m, _a...) \
> +        xc_report_error(xch, XC_INTERNAL_ERROR, _m, ## _a )

... a stray blank ahead of the closing parenthesis here; I'm sure this
can be taken care of while committing.

Jan

> +#define PERROR(_m, _a...) \
> +        xc_report_error(xch, XC_INTERNAL_ERROR, _m " (%d = %s)", \
> +                        ## _a, errno, xc_strerror(xch, errno))
>  
>  /*
>   * HYPERCALL ARGUMENT BUFFERS
> 




 


Rackspace

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