Skip to contentSkip to conversation

mdadm: Drop redundant patches and fix build with clang

PATCH New Khem Raj 1 participant 1 message Dec 8, 2018

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 mdadm: Drop redundant patches and fix build with clang

Several patches were being applied unnecessarily, the purpose they served at one point has either been fixed differently, or accepted upstream.

Add a new patch to make clang's diagnostics happy

---
V2: Keep mdadm-fix-ptest-build-errors.patch
V3: Keep 0001-mdadm.h-Undefine-dprintf-before-redefining.patch

 ...abs-diff-in-a-standard-compliant-way.patch |  31 ++++
 .../files/0001-Disable-gcc8-warnings.patch    | 152 ------------------
 ...smacros.h-for-major-minor-defintions.patch |  44 -----
 ...omment-to-indicate-valid-fallthrough.patch | 124 --------------
 .../mdadm/files/gcc-4.9.patch                 |  31 ----
 meta/recipes-extended/mdadm/mdadm_4.1.bb      |  20 ++-
 6 files changed, 40 insertions(+), 362 deletions(-)
 create mode 100644 meta/recipes-extended/mdadm/files/0001-Compute-abs-diff-in-a-standard-compliant-way.patch
 delete mode 100644 meta/recipes-extended/mdadm/files/0001-Disable-gcc8-warnings.patch
 delete mode 100644 meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
 delete mode 100644 meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
 delete mode 100644 meta/recipes-extended/mdadm/files/gcc-4.9.patch
meta/recipes-extended/mdadm/files/0001-Compute-abs-diff-in-a-standard-compliant-way.patch new file +31 -0
new file mode 100644
index 0000000000..803a59b3ec
@@ -0,0 +1,31 @@
+From b273e892bd6aaafe448f84356abb78a6d463e784 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 7 Dec 2018 17:22:39 -0800
+Subject: [PATCH] Compute abs diff in a standard compliant way
+
+This make it a bit less implementation defined and silences clang
+warning -Wabsolute-value
+
+| super-intel.c:2822:20: error: taking the absolute value of unsigned type 'unsi
+gned long long' has no effect [-Werror,-Wabsolute-value]
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ super-intel.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/super-intel.c b/super-intel.c
+index 6438987..10d7218 100644
+--- a/super-intel.c
++++ b/super-intel.c
+@@ -2819,7 +2819,7 @@ static unsigned long long calc_component_size(struct imsm_map *map,
+ 	 * 2048 blocks per each device. If the difference is higher it means
+ 	 * that array size was expanded and num_data_stripes was not updated.
+ 	 */
+-	if ((unsigned int)abs(calc_dev_size - dev_size) >
++	if ((unsigned int)abs((int)calc_dev_size - (int)dev_size) >
+ 	    (1 << SECT_PER_MB_SHIFT) * member_disks) {
+ 		component_size = dev_size / member_disks;
+ 		dprintf("Invalid num_data_stripes in metadata; expected=%llu, found=%llu\n",
meta/recipes-extended/mdadm/files/0001-Disable-gcc8-warnings.patch deleted +0 -152

152 lines not on this page · raw message

meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch deleted +0 -44

44 lines not on this page · raw message

meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch deleted +0 -124

124 lines not on this page · raw message

meta/recipes-extended/mdadm/files/gcc-4.9.patch deleted +0 -31
deleted file mode 100644
index 473fd7821b..0000000000
@@ -1,31 +0,0 @@
-From 8804bca3de1b79a7c579783b7e3a7603f43bbb48 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Fri, 2 May 2014 16:31:17 -0700
-Subject: [PATCH] mdadm: Fix build on gcc 4.9
-
-super-intel.c:5063:2: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
-  snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH,
-  ^
-cc1: all warnings being treated as errors
-make: *** [super-intel.o] Error 1
-
-Signed-off-by: Khem Raj <[email protected]>
-Upstream-Status: Pending
-
----
- super-intel.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/super-intel.c b/super-intel.c
-index 6438987..e726987 100644
---- a/super-intel.c
-+++ b/super-intel.c
-@@ -5941,7 +5941,7 @@ static int write_super_imsm_spares(struct intel_super *super, int doclose)
- 	spare->cache_size = mpb->cache_size;
- 	spare->pwr_cycle_count = __cpu_to_le32(1);
- 
--	snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH,
-+	(void)snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH,
- 		 MPB_SIGNATURE MPB_VERSION_RAID0);
- 
- 	for (d = super->disks; d; d = d->next) {
meta/recipes-extended/mdadm/mdadm_4.1.bb +9 -11
index b9f55841cb..9118baaf1a 100644
@@ -9,24 +9,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 
 
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
-           file://gcc-4.9.patch \
+           file://run-ptest \
            file://mdadm-3.3.2_x32_abi_time_t.patch \
            file://mdadm-fix-ptest-build-errors.patch \
-           file://0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch \
-           file://run-ptest \
            file://0001-mdadm.h-Undefine-dprintf-before-redefining.patch \
-           file://0001-include-sys-sysmacros.h-for-major-minor-defintions.patch \
-           file://0005-Add-a-comment-to-indicate-valid-fallthrough.patch \
+           file://0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch \
            file://0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch \
-           file://0001-Disable-gcc8-warnings.patch \
+           file://0001-Compute-abs-diff-in-a-standard-compliant-way.patch \
            "
 SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598"
 SRC_URI[sha256sum] = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a"
 
-CFLAGS += "-fno-strict-aliasing"
-inherit autotools-brokensep
+inherit autotools-brokensep ptest
+
+CFLAGS_append_toolchain-clang = " -Wno-error=address-of-packed-member"
 
-EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"'
 # PPC64 and MIPS64 uses long long for u64 in the kernel, but powerpc's asm/types.h
 # prevents 64-bit userland from seeing this definition, instead defaulting
 # to u64 == long in userspace. Define __SANE_USERSPACE_TYPES__ to get
@@ -35,6 +32,8 @@ CFLAGS_append_powerpc64 = ' -D__SANE_USERSPACE_TYPES__'
 CFLAGS_append_mipsarchn64 = ' -D__SANE_USERSPACE_TYPES__'
 CFLAGS_append_mipsarchn32 = ' -D__SANE_USERSPACE_TYPES__'
 
+EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"'
+
 do_compile() {
 	# Point to right sbindir
 	sed -i -e "s;BINDIR  = /sbin;BINDIR = $base_sbindir;" -e "s;UDEVDIR = /lib;UDEVDIR = $nonarch_base_libdir;" ${S}/Makefile
@@ -46,8 +45,6 @@ do_install() {
 	autotools_do_install
 }
 
-inherit ptest
-
 do_compile_ptest() {
 	oe_runmake test
 }
@@ -62,6 +59,7 @@ do_install_ptest() {
 		install -D -m 755 $prg ${D}${PTEST_PATH}/
 	done
 }
+
 RDEPENDS_${PN}-ptest += "bash"
 RRECOMMENDS_${PN}-ptest += " \
     coreutils \
Signature · 1 line
2.19.2