Skip to contentSkip to conversation

xen, tools: console.h shouldn't require string.h by default

PATCH Superseded Wei Liu 2 participants 3 messages Oct 6, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 xen, tools: console.h shouldn't require string.h by default

Unilaterally making string.h a prerequisite for console.h is going to break build for a lot of consumers of console.h.

Define a macro for the new flex ring. Consumers which want to use it should define the macro.

Partially revert af8d9356417cb617b635c5ace782388ebfe86e3a.

---
Cc: Julien Grall <[email protected]>
Cc: Bhupinder Thakur <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/console/daemon/io.c       | 2 +-
 xen/arch/arm/vpl011.c           | 2 ++
 xen/include/Makefile            | 1 -
 xen/include/public/io/console.h | 6 +++---
 4 files changed, 6 insertions(+), 5 deletions(-)
tools/console/daemon/io.c +1 -1
index afe162e9c2..e22009aa39 100644
@@ -21,7 +21,6 @@
 
 #include "utils.h"
 #include "io.h"
-#include <string.h>
 #include <xenevtchn.h>
 #include <xengnttab.h>
 #include <xenstore.h>
@@ -30,6 +29,7 @@
 
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 #include <poll.h>
 #include <fcntl.h>
 #include <unistd.h>
xen/arch/arm/vpl011.c +2 -0
index 56d9cbe09e..f7ddccb42a 100644
@@ -16,6 +16,8 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define XEN_WANT_FLEX_CONSOLE_RING 1
+
 #include <xen/errno.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
xen/include/Makefile +0 -1
index c90fdeee75..1299b1962f 100644
@@ -98,7 +98,6 @@ PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h
 PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
 
 public/io/9pfs.h-prereq := string
-public/io/console.h-prereq := string
 public/io/pvcalls.h-prereq := string
 
 headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
xen/include/public/io/console.h +3 -3
index 0f0711fbdb..cdbdcd273b 100644
@@ -27,8 +27,6 @@
 #ifndef __XEN_PUBLIC_IO_CONSOLE_H__
 #define __XEN_PUBLIC_IO_CONSOLE_H__
 
-#include "ring.h"
-
 typedef uint32_t XENCONS_RING_IDX;
 
 #define MASK_XENCONS_IDX(idx, ring) ((idx) & (sizeof(ring)-1))
@@ -40,7 +38,9 @@ struct xencons_interface {
     XENCONS_RING_IDX out_cons, out_prod;
 };
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
+    defined(XEN_WANT_FLEX_CONSOLE_RING)
+#include "ring.h"
 DEFINE_XEN_FLEX_RING(xencons);
 #endif
 
Signature · 7 lines
2.11.0


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

xen/include/public/io/console.h struct xencons_interface { · line 45

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 06.10.17 at 13:48, <[email protected]> wrote:
xen/include/public/io/console.h +3 -1
@@ -40,7 +38,9 @@ struct xencons_interface {
     XENCONS_RING_IDX out_cons, out_prod;
 };
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
+    defined(XEN_WANT_FLEX_CONSOLE_RING)
+#include "ring.h"
 DEFINE_XEN_FLEX_RING(xencons);
 #endif

Wouldn't it be reasonable to drop the GNU and ANSI checks? Someone not using a suitable compiler simply shouldn't define the macro.

Jan

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

author
#2 lore raw
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 06.10.17 at 13:48, <[email protected]> wrote:
xen/include/public/io/console.h +0 -0
@@ -40,7 +38,9 @@ struct xencons_interface {
     XENCONS_RING_IDX out_cons, out_prod;
 };
 
Quoted 10 lines

xen/include/public/io/console.h struct xencons_interface { · line 45

Quoted 6 lines
xen/include/public/io/console.h +3 -1
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
+    defined(XEN_WANT_FLEX_CONSOLE_RING)
+#include "ring.h"
 DEFINE_XEN_FLEX_RING(xencons);
 #endif

Wouldn't it be reasonable to drop the GNU and ANSI checks? Someone not using a suitable compiler simply shouldn't define the macro.

That would be fine by me.

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