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

[PATCH] x86/HVM: tidy _hvm_load_entry() for style


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 31 Jul 2023 15:31:26 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8u6Ro9TH7gEX09Hl6hvYAKoJ1p86WOM8kiqVVm11DA4=; b=l2tZu7xfavIVHAbxnJUWSWwbnCnrd30KKfOIx4MwCLBiBmpBYePZYeoVblNEGlywVjgc6naZriZTxp8u/5GeTTY+a2WRX4Gm+gcMfy8vhuzkWcLcM1+dIZxW/KmrSTfq0rXRpWpwLuFmiZfMjLtwcbNJGBpz6TBs3RVB04CoJknXHpq5xNqmHEWc2lahSKtPKDZiHXRIQ/0NSQIElcDzHcheyztWWPeX76TMFX/THvcQuBXq7Vt/7BG+dFcLjFlvNvXw1rO7ZiI6RjpL8zm+3gZ9E2rsJSSeZV+x5JdZ6k9ZyL2kPHk4F40n18rzJe8mSNC80qI2meJued8GX+zKYA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DlKISsqCRkQKaKteTv1iFa120j0W1FH7XsHA2zMQGU7udPUeDkfFvutmi9TCQj0e6pTcZd09jEYPVgEu0jxgN9XFcx2iNeRqL/FvpNQ6/r861sraw6L4XC9H493ij3GOWlrZDZkUfhHPwODLsytDmORN7VxS2gwFULRXcHwLojUFg8bSpXJh5Y7Z93xWeIqtXp502zx69mFUGa8b2n5gWAgmZqq/buMBIwh43qiciPq/D7GKvM88zoBcRly6QTGni2gcZHK96CIU/fvJboGy7EMSwPlEgRUrWwygnaqF3YT9Q38GCRAXztSfjEFSDtE0KDx1fb1uUTPhT1922pQiDg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Delivery-date: Mon, 31 Jul 2023 13:31:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The primary goal is to eliminate the Misra-non-compliance of "desc"
shadowing at least the local variable in hvm_load(). Suffix both local
variables with underscores, while also
- dropping leading underscores from parameter names (applying this also
  to the two wrapper macros),
- correcting indentation,
- correcting brace placement,
- dropping unnecessary parentheses around parameter uses when those are
  passed on as plain arguments.

No functional change intended.

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

--- a/xen/arch/x86/include/asm/hvm/save.h
+++ b/xen/arch/x86/include/asm/hvm/save.h
@@ -47,30 +47,32 @@ void _hvm_read_entry(struct hvm_domain_c
  * Unmarshalling: check, then copy. Evaluates to zero on success. This load
  * function requires the save entry to be the same size as the dest structure.
  */
-#define _hvm_load_entry(_x, _h, _dst, _strict) ({                       \
-    int r;                                                              \
-    struct hvm_save_descriptor *desc                                    \
-        = (struct hvm_save_descriptor *)&(_h)->data[(_h)->cur];         \
-    if ( (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),                 \
-               HVM_SAVE_LENGTH(_x), (_strict))) == 0 )                  \
+#define _hvm_load_entry(x, h, dst, strict) ({                           \
+    int r_;                                                             \
+    struct hvm_save_descriptor *desc_                                   \
+        = (struct hvm_save_descriptor *)&(h)->data[(h)->cur];           \
+    if ( (r_ = _hvm_check_entry(h, HVM_SAVE_CODE(x),                    \
+                                HVM_SAVE_LENGTH(x), strict)) == 0 )     \
     {                                                                   \
-        _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH(_x));             \
-        if ( HVM_SAVE_HAS_COMPAT(_x) &&                                 \
-             desc->length != HVM_SAVE_LENGTH(_x) )                      \
-            r = HVM_SAVE_FIX_COMPAT(_x, (_dst), desc->length);          \
+        _hvm_read_entry(h, dst, HVM_SAVE_LENGTH(x));                    \
+        if ( HVM_SAVE_HAS_COMPAT(x) &&                                  \
+             desc_->length != HVM_SAVE_LENGTH(x) )                      \
+            r_ = HVM_SAVE_FIX_COMPAT(x, dst, desc_->length);            \
     }                                                                   \
-    else if (HVM_SAVE_HAS_COMPAT(_x)                                    \
-             && (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x),          \
-                       HVM_SAVE_LENGTH_COMPAT(_x), (_strict))) == 0 ) { \
-        _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH_COMPAT(_x));      \
-        r = HVM_SAVE_FIX_COMPAT(_x, (_dst), desc->length);              \
+    else if (HVM_SAVE_HAS_COMPAT(x)                                     \
+             && (r_ = _hvm_check_entry(h, HVM_SAVE_CODE(x),             \
+                                       HVM_SAVE_LENGTH_COMPAT(x),       \
+                                       strict)) == 0 )                  \
+    {                                                                   \
+        _hvm_read_entry(h, dst, HVM_SAVE_LENGTH_COMPAT(x));             \
+        r_ = HVM_SAVE_FIX_COMPAT(x, dst, desc_->length);                \
     }                                                                   \
-    r; })
+    r_; })
 
-#define hvm_load_entry(_x, _h, _dst)            \
-    _hvm_load_entry(_x, _h, _dst, 1)
-#define hvm_load_entry_zeroextend(_x, _h, _dst) \
-    _hvm_load_entry(_x, _h, _dst, 0)
+#define hvm_load_entry(x, h, dst)            \
+    _hvm_load_entry(x, h, dst, true)
+#define hvm_load_entry_zeroextend(x, h, dst) \
+    _hvm_load_entry(x, h, dst, false)
 
 /* Unmarshalling: what is the instance ID of the next entry? */
 static inline unsigned int hvm_load_instance(const struct hvm_domain_context 
*h)



 


Rackspace

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