libxfs: use system FICLONE/FICLONERANGE/FIDEDUPERANGE definitions
PATCH 1/1 libxfs: use system FICLONE/FICLONERANGE/FIDEDUPERANGE definitions
The clone and dedupe ioctls have been hoisted into the VFS headers, so there's no need to rely on our private version unless we're compiling on a system with old kernel headers. Also, these three ioctls only exist on Linux so there's no point in compiling with them elsewhere.
So, move the ioctl definitions to include/linux.h, use the generic names everywhere, and shut it off on !Linux.
Signed-off-by Darrick J. Wong <[email protected]>
--- configure.ac | 3 ++ include/builddefs.in | 15 +++++++++++- include/linux.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ io/Makefile | 7 +++++ io/io.h | 4 +++ io/reflink.c | 42 ++++++++++++++++----------------- libxfs/xfs_fs.h | 41 -------------------------------- m4/package_libcdev.m4 | 56 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 167 insertions(+), 64 deletions(-)
configure.ac +3 -0
@@ -142,6 +142,9 @@ AC_HAVE_READDIR AC_HAVE_FSETXATTR AC_HAVE_MREMAP AC_NEED_INTERNAL_FSXATTR +AC_HAVE_SYS_FICLONE +AC_HAVE_SYS_FICLONERANGE +AC_HAVE_SYS_FIDEDUPERANGE if test "$enable_blkid" = yes; then AC_HAVE_BLKID_TOPO
include/builddefs.in +14 -1
@@ -112,16 +112,20 @@ HAVE_FLS = @have_fls@ HAVE_FSETXATTR = @have_fsetxattr@ HAVE_MREMAP = @have_mremap@ NEED_INTERNAL_FSXATTR = @need_internal_fsxattr@ +HAVE_SYS_FICLONE = @have_sys_ficlone@ +HAVE_SYS_FICLONERANGE = @have_sys_ficlonerange@ +HAVE_SYS_FIDEDUPERANGE = @have_sys_fideduperange@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall # -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl ifeq ($(PKG_PLATFORM),linux) -PCFLAGS = -D_GNU_SOURCE $(GCCFLAGS) +PCFLAGS = -D_GNU_SOURCE $(GCCFLAGS) -DHAVE_CLONE ifeq ($(HAVE_UMODE_T),yes) PCFLAGS += -DHAVE_UMODE_T endif DEPENDFLAGS = -D__linux__ +HAVE_CLONE = yes endif ifeq ($(PKG_PLATFORM),gnukfreebsd) PCFLAGS = -D_GNU_SOURCE $(GCCFLAGS)
@@ -150,6 +154,15 @@ endif ifeq ($(NEED_INTERNAL_FSXATTR),yes) PCFLAGS+= -DOVERRIDE_SYSTEM_FSXATTR endif +ifeq ($(PKG_PLATFORM)_$(HAVE_SYS_FICLONE),linux_) +PCFLAGS+= -DOVERRIDE_FICLONE +endif +ifeq ($(PKG_PLATFORM)_$(HAVE_SYS_FICLONERANGE),linux_) +PCFLAGS+= -DOVERRIDE_FICLONERANGE +endif +ifeq ($(PKG_PLATFORM)_$(HAVE_SYS_FIDEDUPERANGE),linux_) +PCFLAGS+= -DOVERRIDE_FIDEDUPERANGE +endif GCFLAGS = $(DEBUG) \
include/linux.h +63 -0
74 lines not on this page · raw message
io/Makefile +6 -1
@@ -11,7 +11,7 @@ HFILES = init.h io.h CFILES = init.c \ attr.c bmap.c cowextsize.c encrypt.c file.c freeze.c fsync.c \ getrusage.c imap.c link.c mmap.c open.c parent.c pread.c prealloc.c \ - pwrite.c reflink.c seek.c shutdown.c sync.c truncate.c utimes.c + pwrite.c seek.c shutdown.c sync.c truncate.c utimes.c LLDLIBS = $(LIBXCMD) $(LIBHANDLE) $(LIBPTHREAD) LTDEPENDENCIES = $(LIBXCMD) $(LIBHANDLE)
@@ -99,6 +99,11 @@ ifeq ($(HAVE_MREMAP),yes) LCFLAGS += -DHAVE_MREMAP endif +ifeq ($(HAVE_CLONE),yes) +CFILES += reflink.c +LCFLAGS += -DHAVE_CLONE +endif + default: depend $(LTCOMMAND) include $(BUILDRULES)
io/io.h +4 -0
@@ -170,6 +170,10 @@ extern void readdir_init(void);#define readdir_init () do { } while (0)#endif +#ifdef HAVE_CLONE extern void reflink_init (void ); +#else +#define reflink_init () do { } while (0) +#endif extern void cowextsize_init (void );
io/reflink.c +21 -21
84 lines not on this page · raw message
libxfs/xfs_fs.h +0 -41
47 lines not on this page · raw message
m4/package_libcdev.m4 +56 -0
59 lines not on this page · raw message