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

[PATCH v2 10/13] libxc: simplify HYPERCALL_BUFFER()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 5 Jul 2021 17:16:23 +0200
  • 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-SenderADCheck; bh=0wA9AAqtkrdQU9VPvSonatQPKPM1QlgORRMW1Ye+aCM=; b=HABKzdKtFiT5IH3krVMarL002MTR1X4gSJOPsOSEk5e4M8zHa7QcvbCxrL6dxMklhUZ1HsuwZn1jNqCLu2E6/T201+rMrsVerknA5wnMMLiyXvZrXtpjOdwT06QVt2MNml6cajUf+qKBO4SErfDbtWYRZD3NqfWSD5RDJBhsMDJJrm/+jEf1SkrcC1QqCFhmC50Me05T4RhBYP9TJe1JAQ1T5JWKDy3mRIQgzAexBd8i7r5rtNTZFK6qtNEyhZ+vuVQSQbQZdLRJ9M9qZO2neaNPAbMhe2GqvjSgx9WKqZKaXlMojwaEW5PyMg7U9LEmq+vrQMxedXskHiXhJmVx6g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQqWpj7gBxmMeY9HAbLLd7Ej7yqNMw5Y+/KqOy/U6oM6Shd7L9A/vBCANvBxvnDUxtR1z717M/XuHyPc5kWhA527xXf3ta2dWOPy+faNiGvJQzFwsY03YJzp0pUe83GwUuwBVLm4VO86jSUNBc+EPleKnqYqXuj+Afub5iLNYxKwMvrRzVJ9+wDvSSolrqix6E/RwxQ2dU8CUESbb8LhVgYaEOV4P7plk6qF15eYdppYlucm0i7Bd8ZJB0wCNi3n/biWUgoPftvoQciuzJjAt3NC1UwryHCApVG40gFgD3Z8okTqw/ol0O97IZyNkYZesq8jd6CvDtRjRlBUs0mQgQ==
  • Authentication-results: xenproject.org; dkim=none (message not signed) header.d=none;xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 05 Jul 2021 15:16:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

_hcbuf_buf1 has been there only for a pointer comparison to validate
type compatibility. The same can be achieved by not using typeof() on
the definition of what so far was _hcbuf_buf2, as the initializer has
to also be type-compatible. Drop _hcbuf_buf1 and the comaprison;
rename _hcbuf_buf2.

Since we're already using compiler extensions here, don't be shy and
also omit the middle operand of the involved ?: operator.

Bring line continuation character placement in line with that of
related macros.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.

--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -247,13 +247,10 @@ typedef struct xc_hypercall_buffer xc_hy
 /*
  * Returns the hypercall_buffer associated with a variable.
  */
-#define HYPERCALL_BUFFER(_name)                                 \
-    ({  xc_hypercall_buffer_t _hcbuf_buf1;                      \
-        typeof(XC__HYPERCALL_BUFFER_NAME(_name)) *_hcbuf_buf2 = \
-                &XC__HYPERCALL_BUFFER_NAME(_name);              \
-        (void)(&_hcbuf_buf1 == _hcbuf_buf2);                    \
-        (_hcbuf_buf2)->param_shadow ?                           \
-                (_hcbuf_buf2)->param_shadow : (_hcbuf_buf2);    \
+#define HYPERCALL_BUFFER(_name)                                \
+    ({  xc_hypercall_buffer_t *_hcbuf_buf =                    \
+                &XC__HYPERCALL_BUFFER_NAME(_name);             \
+        _hcbuf_buf->param_shadow ?: _hcbuf_buf;                \
      })
 
 #define HYPERCALL_BUFFER_INIT_NO_BOUNCE .dir = 0, .sz = 0, .ubuf = (void *)-1




 


Rackspace

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