From 2212918aa2ec33c1e586fc532d72bfd6abb524f3 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 24 May 2016 01:32:09 +0000 Subject: [PATCH] tests/btrfs.c: fix build on systems without or * tests/btrfs.c: Include "tests.h" first. Skip the test if [!HAVE_LINUX_BTRFS_H]. Skip parts of the test that use struct fiemap if [!HAVE_LINUX_FIEMAP_H]. --- tests/btrfs.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/btrfs.c b/tests/btrfs.c index 72d817a6..9a3cc0f2 100644 --- a/tests/btrfs.c +++ b/tests/btrfs.c @@ -1,3 +1,7 @@ +#include "tests.h" + +#ifdef HAVE_LINUX_BTRFS_H + #include #include #include @@ -16,9 +20,6 @@ #include #include #include -#include -#include "config.h" -#include "tests.h" #include "xlat.h" #include "xlat/btrfs_balance_args.h" @@ -40,8 +41,11 @@ #include "xlat/btrfs_features_incompat.h" #include "xlat/btrfs_key_types.h" -#include "xlat/fiemap_flags.h" -#include "xlat/fiemap_extent_flags.h" +#ifdef HAVE_LINUX_FIEMAP_H +# include +# include "xlat/fiemap_flags.h" +# include "xlat/fiemap_extent_flags.h" +#endif #ifndef BTRFS_LABEL_SIZE #define BTRFS_LABEL_SIZE 256 @@ -1155,6 +1159,7 @@ btrfs_test_ino_path_ioctls(void) ", size=%" PRI__u64", inodes=0x%" PRI__x64 "}) = -1 EBADF (%m)\n", args.inum, args.size, args.fspath); +#ifdef HAVE_LINUX_FIEMAP_H if (btrfs_test_root) { int size; struct stat si; @@ -1262,6 +1267,7 @@ btrfs_test_ino_path_ioctls(void) close(fd); free(fiemap); } +#endif /* HAVE_LINUX_FIEMAP_H */ } /* @@ -1849,3 +1855,9 @@ main(int argc, char *argv[]) return 0; } + +#else + +SKIP_MAIN_UNDEFINED("HAVE_LINUX_BTRFS_H") + +#endif -- 2.40.0