]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
configure: use pkg-config to find liburing
authorMark Harmstone <maharmstone@fb.com>
Mon, 6 Jan 2025 14:01:33 +0000 (14:01 +0000)
committerZorro Lang <zlang@kernel.org>
Sun, 12 Jan 2025 04:20:17 +0000 (12:20 +0800)
Change our autoconf macros so that instead of checking for the presence
of liburing.h, we use pkg-config.

The benefit of this is that we can then check the version of liburing,
and do conditional compilation based on this. There's a macro
IO_URING_CHECK_VERSION already, but it's only in relatively recent
versions of liburing.h.

This replaces HAVE_URING_H, defined by AC_CHECK_HEADERS, with
HAVE_URING. I also had to rename PKG_{MAJOR,MINOR,REVISION,BUILD} to
start with PACKAGE_, to avoid "possibly undefined macro" errors; it
looks like pkg-config assumes that anything called PKG_* is for its own
use.

Signed-off-by: Mark Harmstone <maharmstone@fb.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
VERSION
m4/package_globals.m4
m4/package_liburing.m4
release.sh
src/feature.c
src/vfs/idmapped-mounts.c
src/vfs/idmapped-mounts.h
src/vfs/tmpfs-idmapped-mounts.c
src/vfs/utils.c
src/vfs/utils.h
src/vfs/vfstest.c

diff --git a/VERSION b/VERSION
index 7294a0022652185b25d093f8338324651a7f132a..afcab53eaa5b440dcc9230429d1aa3ca38fc2c57 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 #
 # This file is used by configure to get version information
 #
-PKG_MAJOR=1
-PKG_MINOR=1
-PKG_REVISION=1
-PKG_BUILD=1
+PACKAGE_MAJOR=1
+PACKAGE_MINOR=1
+PACKAGE_REVISION=1
+PACKAGE_BUILD=1
index ce7a8c51384e767cc51b91aacfcb5df9c4ffaba2..c8d5d124501a1fc7bfd9cc198d2c770e75f15b37 100644 (file)
@@ -9,9 +9,9 @@ AC_DEFUN([AC_PACKAGE_GLOBALS],
     AC_SUBST(pkg_name)
 
     . ./VERSION
-    pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
+    pkg_version=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
     AC_SUBST(pkg_version)
-    pkg_release=$PKG_BUILD
+    pkg_release=$PACKAGE_BUILD
     test -z "$BUILD_VERSION" || pkg_release="$BUILD_VERSION"
     AC_SUBST(pkg_release)
 
index c92cc02ade14830059de1c1cc990b6d5aeb54ea2..0553966d2fcd56bde866ac693b7e3e8a67871a13 100644 (file)
@@ -1,4 +1,8 @@
 AC_DEFUN([AC_PACKAGE_WANT_URING],
-  [ AC_CHECK_HEADERS(liburing.h, [ have_uring=true ], [ have_uring=false ])
+  [ PKG_CHECK_MODULES([LIBURING], [liburing],
+    [ AC_DEFINE([HAVE_LIBURING], [1], [Use liburing])
+      have_uring=true
+    ],
+    [ have_uring=false ])
     AC_SUBST(have_uring)
   ])
index 5b78ec79fe465e5f45bbe1995de1d3ca7b72e34e..70fbf47e83b751356110a0b853a9fe40614a1819 100644 (file)
@@ -5,7 +5,7 @@
 
 . ./VERSION
 
-version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
+version=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
 date=`date +"%-d %B %Y"`
 
 echo "Cleaning up"
index 7e474ce558e623113c887f9a85e1d1bf9498b6aa..7df36acf4cafd6c75465600aae04b3759352da68 100644 (file)
@@ -42,7 +42,7 @@
 #include <libaio.h>
 #endif
 
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 #include <liburing.h>
 #endif
 
@@ -227,7 +227,7 @@ check_aio_support(void)
 static int
 check_uring_support(void)
 {
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
        struct io_uring ring;
        int err;
 
index f4dfc3f3a9378519d863830855142bc70f070f16..ed9992f975c14b57c5d6d1634ca011b015b78bcb 100644 (file)
@@ -2206,7 +2206,7 @@ out:
 }
 
 
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 int tcore_io_uring_idmapped(const struct vfstest_info *info)
 {
        int fret = -1;
@@ -2743,7 +2743,7 @@ out_unmap:
 
        return fret;
 }
-#endif /* HAVE_LIBURING_H */
+#endif /* HAVE_LIBURING */
 
 /* Validate that protected symlinks work correctly on idmapped mounts. */
 int tcore_protected_symlinks_idmapped_mounts(const struct vfstest_info *info)
@@ -8859,7 +8859,7 @@ static const struct test_struct t_idmapped_mounts[] = {
        { tcore_hardlink_crossing_idmapped_mounts,                              true,   "cross idmapped mount hardlink",                                                                },
        { tcore_hardlink_from_idmapped_mount,                                   true,   "hardlinks from idmapped mounts",                                                               },
        { tcore_hardlink_from_idmapped_mount_in_userns,                 true,   "hardlinks from idmapped mounts in user namespace",                                             },
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
        { tcore_io_uring_idmapped,                                              true,   "io_uring from idmapped mounts",                                                                },
        { tcore_io_uring_idmapped_userns,                                       true,   "io_uring from idmapped mounts in user namespace",                                              },
        { tcore_io_uring_idmapped_unmapped,                                     true,   "io_uring from idmapped mounts with unmapped ids",                                              },
index 4a2c7b393613b311a7c39c6740269060b4ea83e9..688394c8a12b438ceb14a1ccdecceb3aedd7fe21 100644 (file)
@@ -30,7 +30,7 @@ int tcore_fscaps_idmapped_mounts_in_userns_separate_userns(const struct vfstest_
 int tcore_hardlink_crossing_idmapped_mounts(const struct vfstest_info *info);
 int tcore_hardlink_from_idmapped_mount(const struct vfstest_info *info);
 int tcore_hardlink_from_idmapped_mount_in_userns(const struct vfstest_info *info);
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 int tcore_io_uring_idmapped(const struct vfstest_info *info);
 int tcore_io_uring_idmapped_userns(const struct vfstest_info *info);
 int tcore_io_uring_idmapped_unmapped(const struct vfstest_info *info);
index 0899aed92461f352b2092fe88a82c1f65ace20b8..d8212bced727f74d6012d7caf0671eb5a4474706 100644 (file)
@@ -167,7 +167,7 @@ static int tmpfs_hardlink_from_idmapped_mount_in_userns(const struct vfstest_inf
        return tmpfs_nested_mount_setup(info, tcore_hardlink_from_idmapped_mount_in_userns);
 }
 
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 static int tmpfs_io_uring_idmapped(const struct vfstest_info *info)
 {
        return tmpfs_nested_mount_setup(info, tcore_io_uring_idmapped);
@@ -184,7 +184,7 @@ static int tmpfs_io_uring_idmapped_unmapped_userns(const struct vfstest_info *in
 {
        return tmpfs_nested_mount_setup(info, tcore_io_uring_idmapped_unmapped_userns);
 }
-#endif /* HAVE_LIBURING_H */
+#endif /* HAVE_LIBURING */
 
 static int tmpfs_protected_symlinks_idmapped_mounts(const struct vfstest_info *info)
 {
@@ -272,7 +272,7 @@ static const struct test_struct t_tmpfs[] = {
        { tmpfs_hardlink_crossing_idmapped_mounts,                              T_REQUIRE_USERNS | T_REQUIRE_IDMAPPED_MOUNTS,   "tmpfs cross idmapped mount hardlink",                                                          },
        { tmpfs_hardlink_from_idmapped_mount,                                   T_REQUIRE_USERNS | T_REQUIRE_IDMAPPED_MOUNTS,   "tmpfs hardlinks from idmapped mounts",                                                         },
        { tmpfs_hardlink_from_idmapped_mount_in_userns,                         T_REQUIRE_USERNS | T_REQUIRE_IDMAPPED_MOUNTS,   "tmpfs hardlinks from idmapped mounts in user namespace",                                               },
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
        { tmpfs_io_uring_idmapped,                                              T_REQUIRE_USERNS | T_REQUIRE_IDMAPPED_MOUNTS,   "tmpfs io_uring from idmapped mounts",                                                                },
        { tmpfs_io_uring_idmapped_userns,                                       T_REQUIRE_USERNS | T_REQUIRE_IDMAPPED_MOUNTS,   "tmpfs io_uring from idmapped mounts in user namespace",                                              },
        { tmpfs_io_uring_idmapped_unmapped,                                     T_REQUIRE_USERNS | T_REQUIRE_IDMAPPED_MOUNTS,   "tmpfs io_uring from idmapped mounts with unmapped ids",                                              },
index 0ab5de15e60ba56b1cba760f1eaf1fc56209d197..c1c7951c46fe807f3e562688ecbc9c0f9ba33b1c 100644 (file)
@@ -502,7 +502,7 @@ out:
        return fret;
 }
 
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 int io_uring_openat_with_creds(struct io_uring *ring, int dfd, const char *path,
                               int cred_id, bool with_link, int *ret_cqe)
 {
@@ -555,7 +555,7 @@ int io_uring_openat_with_creds(struct io_uring *ring, int dfd, const char *path,
 out:
        return ret;
 }
-#endif /* HAVE_LIBURING_H */
+#endif /* HAVE_LIBURING */
 
 /* caps_up - raise all permitted caps */
 int caps_up(void)
index 872fd96f88c9d9129dce7beae1dfb37c666232ff..c086885a76b630184ded6ed1c09cdefdbd979a65 100644 (file)
@@ -25,7 +25,7 @@
 #include <sys/capability.h>
 #endif
 
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 #include <liburing.h>
 #endif
 
@@ -349,11 +349,11 @@ static inline bool switch_fsids(uid_t fsuid, gid_t fsgid)
        return true;
 }
 
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 extern int io_uring_openat_with_creds(struct io_uring *ring, int dfd,
                                      const char *path, int cred_id,
                                      bool with_link, int *ret_cqe);
-#endif /* HAVE_LIBURING_H */
+#endif /* HAVE_LIBURING */
 
 extern int chown_r(int fd, const char *path, uid_t uid, gid_t gid);
 extern int rm_r(int fd, const char *path);
index f842117df11d88d897d1bd92051d755f4cf69990..e0c897bb0ae2f09816fa609b93b4237417da6573 100644 (file)
@@ -1222,7 +1222,7 @@ out:
        return fret;
 }
 
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
 static int io_uring(const struct vfstest_info *info)
 {
        int fret = -1;
@@ -1495,7 +1495,7 @@ out_unmap:
 
        return fret;
 }
-#endif /* HAVE_LIBURING_H */
+#endif /* HAVE_LIBURING */
 
 /* The following tests are concerned with setgid inheritance. These can be
  * filesystem type specific. For xfs, if a new file or directory or node is
@@ -2349,7 +2349,7 @@ static const struct option longopts[] = {
 static const struct test_struct t_basic[] = {
        { fscaps,                                                       T_REQUIRE_USERNS,       "fscaps on regular mounts",                                                                     },
        { hardlink_crossing_mounts,                                     0,                      "cross mount hardlink",                                                                         },
-#ifdef HAVE_LIBURING_H
+#ifdef HAVE_LIBURING
        { io_uring,                                                     0,                      "io_uring",                                                                                     },
        { io_uring_userns,                                              T_REQUIRE_USERNS,       "io_uring in user namespace",                                                                   },
 #endif