瀏覽代碼

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 <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit 8c1868eb31951b56a9cec6268d49195899e890b3)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Fabrice Fontaine 3 年之前
父節點
當前提交
144236b3c7
共有 1 個文件被更改,包括 60 次插入0 次删除
  1. 60 0
      package/stress-ng/0001-Makefile-fix-build-with-kernel-5.6.patch

+ 60 - 0
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 <fontaine.fabrice@gmail.com>
+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 <fontaine.fabrice@gmail.com>
+[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 */