Linux-Block Archive on lore.kernel.org
 help / Atom feed
* [PATCH] Unbreak the continuous integration build
@ 2019-02-11 16:39 Bart Van Assche
  0 siblings, 0 replies; 1+ messages in thread
From: Bart Van Assche @ 2019-02-11 16:39 UTC (permalink / raw)
  To: Omar Sandoval
  Cc: linux-block, Bart Van Assche, Shin'ichiro Kawasaki,
	Chaitanya Kulkarni

The Travis environment in which the continous integration build is run
does not have the <linux/blkzoned.h> header file. Make sure that the
zbdioctl.c source file builds fine without that header file.

Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Fixes: d42cc3f85e0d ("src: Introduce zbdioctl program")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 src/Makefile   | 10 ++++++++--
 src/zbdioctl.c |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 5a0556f2a37f..cb35497a6089 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,3 +1,7 @@
+HAVE_C_HEADER = $(shell if echo "\#include <$(1)>" |			\
+		  $(CC) -x c -c - 2>/dev/null; then echo "$(2)";	\
+		  else echo "$(3)"; fi)
+
 C_TARGETS := \
 	loblksize \
 	loop_get_status_null \
@@ -13,9 +17,11 @@ CXX_TARGETS := \
 
 TARGETS := $(C_TARGETS) $(CXX_TARGETS)
 
-override CFLAGS   := -O2 -Wall -Wshadow $(CFLAGS)
+CONFIG_DEFS := $(call HAVE_C_HEADER,linux/blkzoned.h,-DHAVE_LINUX_BLKZONED_H)
+
+override CFLAGS   := -O2 -Wall -Wshadow $(CFLAGS) $(CONFIG_DEFS)
 override CXXFLAGS := -O2 -std=c++11 -Wall -Wextra -Wshadow -Wno-sign-compare \
-		     -Werror $(CXXFLAGS)
+		     -Werror $(CXXFLAGS) $(CONFIG_DEFS)
 
 all: $(TARGETS)
 
diff --git a/src/zbdioctl.c b/src/zbdioctl.c
index 93a0f88431b5..9432a8a95b1d 100644
--- a/src/zbdioctl.c
+++ b/src/zbdioctl.c
@@ -6,7 +6,9 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#ifdef HAVE_LINUX_BLKZONED_H
 #include <linux/blkzoned.h>
+#endif
 #include <linux/types.h>
 
 #ifndef BLKGETZONESZ
-- 
2.20.1.791.gb4d0f1c61a-goog


^ permalink raw reply	[flat|nested] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 16:39 [PATCH] Unbreak the continuous integration build Bart Van Assche

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox