Skip to contentSkip to conversation

xen: cleanup xen.h

PATCH Applied Juergen Gross 2 participants 7 messages Jul 27, 2017 – Aug 16, 2017 Xen hypervisor interface

lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

PATCH 1/1 xen: cleanup xen.h

The macros for testing domain types are more complicated then they need to. Simplify them.

---
 include/xen/xen.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
include/xen/xen.h +9 -11
index 6e8b7fc79801..28c59ca529d7 100644
@@ -13,11 +13,16 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_domain_type		XEN_NATIVE
 #endif
 
+#ifdef CONFIG_XEN_PVH
+extern bool xen_pvh;
+#else
+#define xen_pvh			0
+#endif
+
 #define xen_domain()		(xen_domain_type != XEN_NATIVE)
-#define xen_pv_domain()		(xen_domain() &&			\
-				 xen_domain_type == XEN_PV_DOMAIN)
-#define xen_hvm_domain()	(xen_domain() &&			\
-				 xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)
+#define xen_hvm_domain()	(xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pvh_domain()	(xen_pvh)
 
 #ifdef CONFIG_XEN_DOM0
 #include <xen/interface/xen.h>
@@ -29,11 +34,4 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_initial_domain()	(0)
 #endif	/* CONFIG_XEN_DOM0 */
 
-#ifdef CONFIG_XEN_PVH
-extern bool xen_pvh;
-#define xen_pvh_domain()	(xen_hvm_domain() && xen_pvh)
-#else
-#define xen_pvh_domain()	(0)
-#endif
-
 #endif	/* _XEN_XEN_H */
Signature · 1 line
2.12.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Juergen Gross

The macros for testing domain types are more complicated then they need to. Simplify them.

---
 include/xen/xen.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
include/xen/xen.h +2 -0
index 6e8b7fc79801..28c59ca529d7 100644
@@ -13,11 +13,16 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_domain_type		XEN_NATIVE
 #endif
 
+#ifdef CONFIG_XEN_PVH
+extern bool xen_pvh;

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 23

Quoted 10 lines
include/xen/xen.h +5 -4
+#else
+#define xen_pvh			0
+#endif
+
 #define xen_domain()		(xen_domain_type != XEN_NATIVE)
-#define xen_pv_domain()		(xen_domain() &&			\
-				 xen_domain_type == XEN_PV_DOMAIN)
-#define xen_hvm_domain()	(xen_domain() &&			\
-				 xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)

Stray tab.

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 25

Quoted 2 lines
include/xen/xen.h +2 -0
+#define xen_hvm_domain()	(xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pvh_domain()	(xen_pvh)

Not sure we need parentheses here.

Either way

Quoted 5 lines
include/xen/xen.h +0 -0
 #ifdef CONFIG_XEN_DOM0
 #include <xen/interface/xen.h>
@@ -29,11 +34,4 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_initial_domain()	(0)

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 37

Quoted 10 lines
include/xen/xen.h +0 -7
 #endif	/* CONFIG_XEN_DOM0 */
 
-#ifdef CONFIG_XEN_PVH
-extern bool xen_pvh;
-#define xen_pvh_domain()	(xen_hvm_domain() && xen_pvh)
-#else
-#define xen_pvh_domain()	(0)
-#endif
-
 #endif	/* _XEN_XEN_H */

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Juergen Gross
Quoted 18 lines · Juergen Gross

The macros for testing domain types are more complicated then they need to. Simplify them.

---
 include/xen/xen.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
include/xen/xen.h +2 -0
index 6e8b7fc79801..28c59ca529d7 100644
@@ -13,11 +13,16 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_domain_type		XEN_NATIVE
 #endif
 
+#ifdef CONFIG_XEN_PVH
+extern bool xen_pvh;

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 23

Quoted 10 lines
include/xen/xen.h +5 -4
+#else
+#define xen_pvh			0
+#endif
+
 #define xen_domain()		(xen_domain_type != XEN_NATIVE)
-#define xen_pv_domain()		(xen_domain() &&			\
-				 xen_domain_type == XEN_PV_DOMAIN)
-#define xen_hvm_domain()	(xen_domain() &&			\
-				 xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)

Stray tab.

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 25

Quoted 2 lines
include/xen/xen.h +2 -0
+#define xen_hvm_domain()	(xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pvh_domain()	(xen_pvh)

Not sure we need parentheses here.

Either way

Quoted 15 lines
include/xen/xen.h +0 -7
 #ifdef CONFIG_XEN_DOM0
 #include <xen/interface/xen.h>
@@ -29,11 +34,4 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_initial_domain()	(0)
 #endif	/* CONFIG_XEN_DOM0 */
 
-#ifdef CONFIG_XEN_PVH
-extern bool xen_pvh;
-#define xen_pvh_domain()	(xen_hvm_domain() && xen_pvh)
-#else
-#define xen_pvh_domain()	(0)
-#endif
-
 #endif	/* _XEN_XEN_H */
author maintainer
#3 lore raw
Quoted 17 lines · Boris Ostrovsky
Quoted 16 lines · Juergen Gross

The macros for testing domain types are more complicated then they need to. Simplify them.

---
 include/xen/xen.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
include/xen/xen.h +0 -0
index 6e8b7fc79801..28c59ca529d7 100644
@@ -13,11 +13,16 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_domain_type		XEN_NATIVE
 #endif
 
Quoted 14 lines

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 23

Quoted 12 lines
include/xen/xen.h +7 -4
+#ifdef CONFIG_XEN_PVH
+extern bool xen_pvh;
+#else
+#define xen_pvh			0
+#endif
+
 #define xen_domain()		(xen_domain_type != XEN_NATIVE)
-#define xen_pv_domain()		(xen_domain() &&			\
-				 xen_domain_type == XEN_PV_DOMAIN)
-#define xen_hvm_domain()	(xen_domain() &&			\
-				 xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)

Stray tab.

No. This is just due to the '+' of the patch.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author maintainer
#4 lore raw
In reply to Boris Ostrovsky
Quoted 17 lines · Boris Ostrovsky
Quoted 16 lines · Juergen Gross

The macros for testing domain types are more complicated then they need to. Simplify them.

---
 include/xen/xen.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
include/xen/xen.h +0 -0
index 6e8b7fc79801..28c59ca529d7 100644
@@ -13,11 +13,16 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_domain_type		XEN_NATIVE
 #endif
 
Quoted 14 lines

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 23

Quoted 12 lines
include/xen/xen.h +7 -4
+#ifdef CONFIG_XEN_PVH
+extern bool xen_pvh;
+#else
+#define xen_pvh			0
+#endif
+
 #define xen_domain()		(xen_domain_type != XEN_NATIVE)
-#define xen_pv_domain()		(xen_domain() &&			\
-				 xen_domain_type == XEN_PV_DOMAIN)
-#define xen_hvm_domain()	(xen_domain() &&			\
-				 xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)

Stray tab.

No. This is just due to the '+' of the patch.

Juergen

#5 lore raw
Quoted 31 lines · Juergen Gross
Quoted 17 lines · Boris Ostrovsky
Quoted 16 lines · Juergen Gross

The macros for testing domain types are more complicated then they need to. Simplify them.

---
 include/xen/xen.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
include/xen/xen.h +0 -0
index 6e8b7fc79801..28c59ca529d7 100644
@@ -13,11 +13,16 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_domain_type		XEN_NATIVE
 #endif
 
Quoted 13 lines

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 23

Quoted 12 lines
include/xen/xen.h +7 -4
+#ifdef CONFIG_XEN_PVH
+extern bool xen_pvh;
+#else
+#define xen_pvh			0
+#endif
+
 #define xen_domain()		(xen_domain_type != XEN_NATIVE)
-#define xen_pv_domain()		(xen_domain() &&			\
-				 xen_domain_type == XEN_PV_DOMAIN)
-#define xen_hvm_domain()	(xen_domain() &&			\
-				 xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)

Stray tab.

Quoted 1 line

No. This is just due to the '+' of the patch.

Applied to for-linus-4.14

-boris

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
In reply to Juergen Gross
Quoted 31 lines · Juergen Gross
Quoted 17 lines · Boris Ostrovsky
Quoted 16 lines · Juergen Gross

The macros for testing domain types are more complicated then they need to. Simplify them.

---
 include/xen/xen.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
include/xen/xen.h +0 -0
index 6e8b7fc79801..28c59ca529d7 100644
@@ -13,11 +13,16 @@ extern enum xen_domain_type xen_domain_type;
 #define xen_domain_type		XEN_NATIVE
 #endif
 
Quoted 13 lines

include/xen/xen.h extern enum xen_domain_type xen_domain_type; · line 23

Quoted 12 lines
include/xen/xen.h +7 -4
+#ifdef CONFIG_XEN_PVH
+extern bool xen_pvh;
+#else
+#define xen_pvh			0
+#endif
+
 #define xen_domain()		(xen_domain_type != XEN_NATIVE)
-#define xen_pv_domain()		(xen_domain() &&			\
-				 xen_domain_type == XEN_PV_DOMAIN)
-#define xen_hvm_domain()	(xen_domain() &&			\
-				 xen_domain_type == XEN_HVM_DOMAIN)
+#define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)

Stray tab.

Quoted 1 line

No. This is just due to the '+' of the patch.

Applied to for-linus-4.14

-boris