From patchwork Thu Feb 6 13:59:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 3596241 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 904B59F38B for ; Thu, 6 Feb 2014 13:59:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D6A7A20163 for ; Thu, 6 Feb 2014 13:59:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E27920170 for ; Thu, 6 Feb 2014 13:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932905AbaBFN7Y (ORCPT ); Thu, 6 Feb 2014 08:59:24 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42935 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932741AbaBFN7W (ORCPT ); Thu, 6 Feb 2014 08:59:22 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A495DABD0; Thu, 6 Feb 2014 13:59:21 +0000 (UTC) From: David Disseldorp To: xfs@oss.sgi.com Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org, David Disseldorp Subject: [PATCH v2 2/3] src/cloner: use btrfs/ioctl.h header if present Date: Thu, 6 Feb 2014 14:59:13 +0100 Message-Id: <1391695154-2039-3-git-send-email-ddiss@suse.de> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1391695154-2039-1-git-send-email-ddiss@suse.de> References: <1391695154-2039-1-git-send-email-ddiss@suse.de> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #include #include +#ifdef HAVE_BTRFS_IOCTL_H +#include +#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)