From 8c1868eb31951b56a9cec6268d49195899e890b3 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Sat, 13 Aug 2022 20:44:48 +0200 Subject: [PATCH] package/stress-ng: fix build with kernel >= 5.1 and < 5.6 Fix the following build failure with kernel >= 5.1 and < 5.6 (i.e. before https://github.com/torvalds/linux/commit/9e3aa61ae3e01ce1ce6361a41ef725e1f4d1d2bf) raised since bump to version 0.12.02 in commit e551fe76e2073f15b0fcf92a73bb6b7334b017b3 and https://github.com/ColinIanKing/stress-ng/commit/3d6fccdbe53d0cbcb75dd4b91571aaaae7ee1ad4: In file included from stress-io-uring.c:26: io-uring.h:1:9: error: macro names must be identifiers 1 | #define #define HAVE_IORING_OP_NOP 0 | ^ Fixes: - http://autobuild.buildroot.org/results/1bf3f2bbc849bdce531d56b1024fa87f0c1ae667 Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni --- ...1-Makefile-fix-build-with-kernel-5.6.patch | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 package/stress-ng/0001-Makefile-fix-build-with-kernel-5.6.patch diff --git a/package/stress-ng/0001-Makefile-fix-build-with-kernel-5.6.patch b/package/stress-ng/0001-Makefile-fix-build-with-kernel-5.6.patch new file mode 100644 index 0000000000..4c62da3241 --- /dev/null +++ b/package/stress-ng/0001-Makefile-fix-build-with-kernel-5.6.patch @@ -0,0 +1,60 @@ +From 5d419c790e648c7a2f96f34ed1b93b326f725545 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Sat, 13 Aug 2022 17:17:05 +0200 +Subject: [PATCH] Makefile: fix build with kernel < 5.6 + +Fix the following build failure with kernel >= 5.1 and < 5.5 (i.e. +before +https://github.com/torvalds/linux/commit/9e3aa61ae3e01ce1ce6361a41ef725e1f4d1d2bf) +raised since version 0.11.21 and +https://github.com/ColinIanKing/stress-ng/commit/3d6fccdbe53d0cbcb75dd4b91571aaaae7ee1ad4: + +In file included from stress-io-uring.c:26: +io-uring.h:1:9: error: macro names must be identifiers + 1 | #define #define HAVE_IORING_OP_NOP 0 + | ^ + +Moreover, IORING_OP_FALLOCATE is not available before kernel 5.6 and +https://github.com/torvalds/linux/commit/d63d1b5edb7b832210bfde587ba9e7549fa064eb + +Fixes: + - http://autobuild.buildroot.org/results/1bf3f2bbc849bdce531d56b1024fa87f0c1ae667 + +Signed-off-by: Fabrice Fontaine +[Retrieved (and backported) from +https://github.com/ColinIanKing/stress-ng/commit/5d419c790e648c7a2f96f34ed1b93b326f725545] +--- + Makefile | 2 +- + stress-io-uring.c | 6 +++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 2f9cc9918..ee17ae08b 100644 +--- a/Makefile ++++ b/Makefile +@@ -528,7 +528,7 @@ stress-personality.c: personality.h + # + io-uring.h: + $(V)$(CPP) $(CFLAGS) core-io-uring.c | $(GREP) IORING_OP | sed 's/,//' | \ +- sed 's/IORING_OP_/#define HAVE_IORING_OP_/' > io-uring.h ++ sed 's/.*\(IORING_OP_.*\)/#define HAVE_\1/' > io-uring.h + $(Q)echo "MK io-uring.h" + + stress-io-uring.c: io-uring.h +diff --git a/stress-io-uring.c b/stress-io-uring.c +index ab9fd0749..84f463611 100644 +--- a/stress-io-uring.c ++++ b/stress-io-uring.c +@@ -311,7 +311,11 @@ static inline int stress_io_uring_complete( + break; + + cqe = &cring->cqes[head & *submit->cq_ring.ring_mask]; +- if ((cqe->res < 0) && (opcode != IORING_OP_FALLOCATE)) { ++ if ((cqe->res < 0) ++#ifdef HAVE_IORING_OP_FALLOCATE ++ && (opcode != IORING_OP_FALLOCATE) ++#endif ++ ) { + const int err = abs(cqe->res); + + /* Silently ignore EOPNOTSUPP completion errors */