From: David Disseldorp <ddiss@suse.de>
To: xfs@oss.sgi.com
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org,
David Disseldorp <ddiss@suse.de>
Subject: [PATCH v2 2/3] src/cloner: use btrfs/ioctl.h header if present
Date: Thu, 6 Feb 2014 14:59:13 +0100 [thread overview]
Message-ID: <1391695154-2039-3-git-send-email-ddiss@suse.de> (raw)
In-Reply-To: <1391695154-2039-1-git-send-email-ddiss@suse.de>
Check for the btrfsprogs-devel ioctl.h header at configure time. Use it
in src/cloner if present, otherwise fall back to using the copied clone
ioctl definitions.
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
configure.ac | 1 +
src/cloner.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/configure.ac b/configure.ac
index bd48fd9..6fba3ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_HEADER_STDC
AC_CHECK_HEADERS([ sys/fs/xfs_fsops.h \
sys/fs/xfs_itable.h \
xfs/platform_defs.h \
+ btrfs/ioctl.h \
])
AC_PACKAGE_NEED_UUIDCOMPARE
diff --git a/src/cloner.c b/src/cloner.c
index dfce837..ccc2354 100644
--- a/src/cloner.c
+++ b/src/cloner.c
@@ -30,6 +30,9 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#ifdef HAVE_BTRFS_IOCTL_H
+#include <btrfs/ioctl.h>
+#else
struct btrfs_ioctl_clone_range_args {
int64_t src_fd;
@@ -42,6 +45,7 @@ struct btrfs_ioctl_clone_range_args {
#define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
struct btrfs_ioctl_clone_range_args)
+#endif
static void
usage(char *name, const char *msg)
--
1.8.4.5
next prev parent reply other threads:[~2014-02-06 13:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 13:59 [PATCH v2 0/3] __btrfs_drop_extents() BUG_ON reproducer David Disseldorp
2014-02-06 13:59 ` [PATCH v2 1/3] btrfs: add small program for clone testing David Disseldorp
2014-02-06 13:59 ` David Disseldorp [this message]
2014-02-06 13:59 ` [PATCH v2 3/3] btrfs/035: add new clone overwrite regression test David Disseldorp
2014-02-06 22:45 ` Dave Chinner
2014-02-07 10:31 ` David Disseldorp
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=1391695154-2039-3-git-send-email-ddiss@suse.de \
--to=ddiss@suse.de \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=xfs@oss.sgi.com \
/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 NNTP newsgroup(s).