trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinson Lee <vlee@freedesktop.org>
To: trinity@vger.kernel.org
Subject: [PATCH] Check for btrfs_ioctl_defrag_range_args.
Date: Fri, 17 Mar 2017 22:58:28 +0000	[thread overview]
Message-ID: <1489791508-24580-1-git-send-email-vlee@freedesktop.org> (raw)

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

                 reply	other threads:[~2017-03-17 22:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1489791508-24580-1-git-send-email-vlee@freedesktop.org \
    --to=vlee@freedesktop.org \
    --cc=trinity@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).