All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [PATCH 1/8] tools/libxl: Simplify DOMCTL_CDF_ flags handling in libxl__domain_make()
Date: Wed, 30 Sep 2020 14:42:41 +0100	[thread overview]
Message-ID: <20200930134248.4918-2-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20200930134248.4918-1-andrew.cooper3@citrix.com>

The use of the ternary operator serves only to obfuscate the code.  Rewrite it
in more simple terms, avoiding the need to conditionally OR zero into the
flags.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl_create.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 1031b75159..ed671052d7 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -612,10 +612,12 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
 
         if (info->type != LIBXL_DOMAIN_TYPE_PV) {
             create.flags |= XEN_DOMCTL_CDF_hvm;
-            create.flags |=
-                libxl_defbool_val(info->hap) ? XEN_DOMCTL_CDF_hap : 0;
-            create.flags |=
-                libxl_defbool_val(info->oos) ? 0 : XEN_DOMCTL_CDF_oos_off;
+
+            if ( libxl_defbool_val(info->hap) )
+                create.flags |= XEN_DOMCTL_CDF_hap;
+
+            if ( !libxl_defbool_val(info->oos) )
+                create.flags |= XEN_DOMCTL_CDF_oos_off;
         }
 
         assert(info->passthrough != LIBXL_PASSTHROUGH_DEFAULT);
-- 
2.11.0



  reply	other threads:[~2020-09-30 13:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 13:42 [PATCH 0/8] x86: Untangle Nested virt and CPUID interactions Andrew Cooper
2020-09-30 13:42 ` Andrew Cooper [this message]
2020-10-01  9:26   ` [PATCH 1/8] tools/libxl: Simplify DOMCTL_CDF_ flags handling in libxl__domain_make() Roger Pau Monné
2020-10-01 10:54   ` Wei Liu
2020-09-30 13:42 ` [PATCH 2/8] xen/domctl: Simplify DOMCTL_CDF_ checking logic Andrew Cooper
2020-10-01  9:39   ` Roger Pau Monné
2020-10-01 10:55   ` Wei Liu
2020-09-30 13:42 ` [PATCH 3/8] xen/domctl: Introduce and use XEN_DOMCTL_CDF_nested_virt Andrew Cooper
2020-09-30 15:55   ` Edwin Torok
2020-10-01 10:01   ` Roger Pau Monné
2020-10-01 10:23   ` Jan Beulich
2020-10-01 11:02     ` Andrew Cooper
2020-10-05  8:32       ` Christian Lindig
2020-10-01 10:56   ` Wei Liu
2020-09-30 13:42 ` [PATCH 4/8] tools/cpuid: Plumb nested_virt down into xc_cpuid_apply_policy() Andrew Cooper
2020-10-01 10:06   ` Roger Pau Monné
2020-10-01 10:56   ` Wei Liu
2020-09-30 13:42 ` [PATCH 5/8] x86/hvm: Obsolete the use of HVM_PARAM_NESTEDHVM Andrew Cooper
2020-10-01 10:53   ` Roger Pau Monné
2020-10-01 10:57   ` Wei Liu
2020-09-30 13:42 ` [PATCH 6/8] xen/xsm: Drop xsm_hvm_param_nested() Andrew Cooper
2020-10-01 10:54   ` Roger Pau Monné
2020-10-01 10:57   ` Wei Liu
2020-09-30 13:42 ` [PATCH 7/8] x86/hvm: Drop restore boolean from hvm_cr4_guest_valid_bits() Andrew Cooper
2020-10-01 11:00   ` Roger Pau Monné
2020-10-05 11:07     ` Andrew Cooper
2020-09-30 13:42 ` [PATCH 8/8] x86/cpuid: Move VMX/SVM out of the default policy Andrew Cooper
2020-10-01 11:04   ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200930134248.4918-2-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.