]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
xfstest: add detection for ext4.h presence in configure.ac
authorDisha Goel <disgoel@linux.ibm.com>
Fri, 1 Mar 2024 08:15:40 +0000 (13:45 +0530)
committerZorro Lang <zlang@kernel.org>
Tue, 12 Mar 2024 03:39:52 +0000 (11:39 +0800)
commit7a338a6af80d6b856551265f156c7958a0f07237
tree597ad33225d8428119a31383d9c7747d4e42c19c
parent70fc4244b7dc015c6d371b3c32ed6d92c4f03b37
xfstest: add detection for ext4.h presence in configure.ac

In some distributions, __u64 is already defined in system header files,
causing compilation errors when building xfstest.

        # make
            [CC]    ext4_resize
        ext4_resize.c:17:28: error: conflicting types for '__u64'
         typedef unsigned long long __u64;
                                    ^~~~~
        In file included from /usr/include/asm/types.h:26:0,
                         from /usr/include/linux/types.h:5,
                         from /usr/include/linux/mount.h:4,
                         from /usr/include/sys/mount.h:32,
                         from ext4_resize.c:15:
        /usr/include/asm-generic/int-l64.h:30:23: note: previous declaration of '__u64' was here
         typedef unsigned long __u64;
                       ^~~~~

To address this issue, configure.ac now checks for the presence and
compilability of <linux/ext4.h>. If found and compilable, the macro
HAVE_LINUX_EXT4_H is defined. The commit also updates src/ext4_resize.c
to conditionally include <linux/ext4.h> based on the presence of the
header, ensuring compatibility with systems where ext4.h is either
present or not. Also include <linux/types.h> which gets __u64
definition on systems where ext4.h is not present. This change
enhances the configure process and improves code consistency.

The changes were tested on various distributions on Power
architecture, by successfully compiling xfstest. Additionally,
verified the compatibility by running ext4/033 and ext4/056
tests, both of which use ext4_resize and observed successful
test execution.

        # make
checking linux/ext4.h usability... yes
        checking linux/ext4.h presence... yes
        checking for linux/ext4.h... yes
            [CC]    detached_mounts_propagation
            [CC]    ext4_resize
            [CC]    t_readdir_3

        # make
        checking linux/ext4.h usability... no
        checking linux/ext4.h presence... no
        checking for linux/ext4.h... no
            [CC]    detached_mounts_propagation
            [CC]    ext4_resize
            [CC]    t_snapshot_deleted_subvolume

Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
configure.ac
src/ext4_resize.c