trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Check for btrfs_ioctl_defrag_range_args.
@ 2017-03-17 22:58 Vinson Lee
  0 siblings, 0 replies; only message in thread
From: Vinson Lee @ 2017-03-17 22:58 UTC (permalink / raw)
  To: trinity

btrfs_ioctl_defrag_range_args is not available until Linux 4.7.

Fix build error on earlier kernels.

  CC	ioctls/btrfs.o
In file included from /usr/include/x86_64-linux-gnu/asm/ioctl.h:1:0,
                 from /usr/include/linux/ioctl.h:4,
                 from /usr/include/linux/fs.h:10,
                 from ioctls/btrfs.c:3:
ioctls/btrfs.c:71:49: error: invalid application of ‘sizeof’ to incomplete type ‘struct btrfs_ioctl_defrag_range_args’
  { .name = "BTRFS_IOC_DEFRAG_RANGE", .request = BTRFS_IOC_DEFRAG_RANGE, },
                                                 ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 configure | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 03632d7..770d15b 100755
--- a/configure
+++ b/configure
@@ -251,12 +251,36 @@ else
 fi
 
 #############################################################################################
+# is /usr/include/linux/btrfs.h new enough to feature btrfs
+#
+echo -n "[*] Checking if btrfs can use btrfs_ioctl_defrag_range_args.. "
+rm -f "$TMP" || exit 1
+
+cat >"$TMP.c" << EOF
+#include <stdio.h>
+#include <linux/btrfs.h>
+
+void main()
+{
+	struct btrfs_ioctl_defrag_range_args args;
+}
+EOF
+
+${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
+if [ ! -x "$TMP" ]; then
+        echo $RED "[NO]" $COL_RESET
+        MISSING_DEFS=1
+else
+        echo $GREEN "[YES]" $COL_RESET
+        echo "#define USE_BTRFS 1" >> $CONFIGH
+fi
+
+#############################################################################################
 
 check_header linux/caif/caif_socket.h USE_CAIF
 check_header linux/if_alg.h USE_IF_ALG
 check_header linux/rds.h USE_RDS
 check_header linux/vfio.h USE_VFIO
-check_header linux/btrfs.h USE_BTRFS
 check_header drm/drm.h USE_DRM
 check_header drm/exynos_drm.h USE_DRM_EXYNOS
 check_header sound/compress_offload.h USE_SNDDRV_COMPRESS_OFFLOAD
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-17 22:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-17 22:58 [PATCH] Check for btrfs_ioctl_defrag_range_args Vinson Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).