public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Tulak <jtulak@redhat.com>
To: xfs@oss.sgi.com
Cc: hch@infradead.org, Jan Tulak <jtulak@redhat.com>
Subject: [PATCH v2] xfsprogs: Make mremap conditional
Date: Thu,  3 Sep 2015 12:35:10 +0200	[thread overview]
Message-ID: <1441276510-23637-1-git-send-email-jtulak@redhat.com> (raw)
In-Reply-To: <1440590555-20463-11-git-send-email-jtulak@redhat.com>

Don't build mremap (in xfs_io) on platforms where it has no support.

CHANGELOG:
 - subject was xfsprogs: add dummy mremap for OS X

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 include/darwin.h      |  1 +
 io/mmap.c             |  8 ++++++++
 m4/package_libcdev.m4 | 13 +++++++++++++
 5 files changed, 24 insertions(+)

diff --git a/configure.ac b/configure.ac
index 13aa308..01dd1a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,7 @@ AC_HAVE_MNTENT
 AC_HAVE_FLS
 AC_HAVE_READDIR
 AC_HAVE_FSETXATTR
+AC_HAVE_MREMAP
 
 if test "$enable_blkid" = yes; then
 AC_HAVE_BLKID_TOPO
diff --git a/include/builddefs.in b/include/builddefs.in
index 31e21ba..c1797fd 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -107,6 +107,7 @@ HAVE_READDIR = @have_readdir@
 HAVE_MNTENT = @have_mntent@
 HAVE_FLS = @have_fls@
 HAVE_FSETXATTR = @have_fsetxattr@
+HAVE_MREMAP = @have_mremap@
 
 GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall 
 #	   -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
diff --git a/include/darwin.h b/include/darwin.h
index af76f31..9f7a00b 100644
--- a/include/darwin.h
+++ b/include/darwin.h
@@ -33,6 +33,7 @@
 #include <mach/mach_time.h>
 #include <inttypes.h>
 #include <stdio.h>
+#include <sys/mman.h>
 
 #include <machine/endian.h>
 #define __BYTE_ORDER	BYTE_ORDER
diff --git a/io/mmap.c b/io/mmap.c
index f26276e..7093650 100644
--- a/io/mmap.c
+++ b/io/mmap.c
@@ -28,7 +28,9 @@ static cmdinfo_t mread_cmd;
 static cmdinfo_t msync_cmd;
 static cmdinfo_t munmap_cmd;
 static cmdinfo_t mwrite_cmd;
+#ifdef HAVE_MREMAP
 static cmdinfo_t mremap_cmd;
+#endif /* HAVE_MREMAP */
 
 mmap_region_t	*maptable;
 int		mapcount;
@@ -574,6 +576,7 @@ mwrite_f(
 	return 0;
 }
 
+#ifdef HAVE_MREMAP
 static void
 mremap_help(void)
 {
@@ -633,6 +636,7 @@ mremap_f(
 
 	return 0;
 }
+#endif /* HAVE_MREMAP */
 
 void
 mmap_init(void)
@@ -688,6 +692,7 @@ mmap_init(void)
 		_("writes data into a region in the current memory mapping");
 	mwrite_cmd.help = mwrite_help;
 
+#ifdef HAVE_MREMAP
 	mremap_cmd.name = "mremap";
 	mremap_cmd.altname = "mrm";
 	mremap_cmd.cfunc = mremap_f;
@@ -698,11 +703,14 @@ mmap_init(void)
 	mremap_cmd.oneline =
 		_("alters the size of the current memory mapping");
 	mremap_cmd.help = mremap_help;
+#endif /* HAVE_MREMAP */
 
 	add_command(&mmap_cmd);
 	add_command(&mread_cmd);
 	add_command(&msync_cmd);
 	add_command(&munmap_cmd);
 	add_command(&mwrite_cmd);
+#ifdef HAVE_MREMAP
 	add_command(&mremap_cmd);
+#endif /* HAVE_MREMAP */
 }
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 5e900ab..b6a7a54 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -235,3 +235,16 @@ AC_DEFUN([AC_HAVE_MNTENT],
     have_mntent=yes)
     AC_SUBST(have_mntent)
   ])
+
+#
+# Check if we have a mremap call (not on Mac OS X)
+#
+AC_DEFUN([AC_HAVE_MREMAP],
+  [ AC_CHECK_DECL([mremap],
+       have_mremap=yes,
+       [],
+       [#define _GNU_SOURCE
+        #include <sys/mman.h>]
+       )
+    AC_SUBST(have_mremap)
+  ])
-- 
2.4.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2015-09-03 10:35 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26 12:00 [PATCH 00/11 v4] xfsprogs: Partial OSX support Jan Tulak
2015-08-26 12:02 ` [PATCH 01/11] xfsprogs: Add a way to compile without blkid Jan Tulak
2015-08-26 12:02   ` [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX Jan Tulak
2015-08-26 22:01     ` Dave Chinner
2015-08-27  6:06       ` Jan Tulak
2015-08-27  6:02     ` Jan Tulak
2015-09-03 10:33       ` [PATCH 02a/11] xfsprogs: Add XATTR_LIST_MAX to OS X headers Jan Tulak
2015-09-03 10:33         ` [PATCH 02b/11] xfsprogs: avoid dependency on Linux XATTR_SIZE_MAX Jan Tulak
2015-09-03 10:33         ` [PATCH 02c/11] xfsprogs: prefix XATTR_LIST_MAX with XFS_ Jan Tulak
2015-08-31 18:58     ` [PATCH 02/11] xfsprogs: avoid dependency on linux XATTR_SIZE/LIST_MAX Christoph Hellwig
2015-09-01  8:13       ` Jan Tulak
2015-09-01  8:35         ` Jan Tulak
2015-08-26 12:02   ` [PATCH 03/11] xfsprogs: Add includes required for OS X builds (delta) Jan Tulak
2015-08-31 18:58     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 04/11] xfsprogs: Add autoconf check for fsetxattr call Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 05/11] xfsprogs: uuid changes for OS X Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 06/11] xfsprogs: Remove conflicting define " Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-08-26 12:02   ` [PATCH 07/11] xfsprogs: add nftw64 translation " Jan Tulak
2015-08-31 18:59     ` Christoph Hellwig
2015-09-01  7:49       ` Jan Tulak
2015-09-01  8:04       ` [PATCH v2] " Jan Tulak
2015-09-01 16:31         ` Darrick J. Wong
2015-09-01 17:24           ` Christoph Hellwig
2015-09-02  7:12           ` Jan Tulak
2015-09-03 10:39     ` [PATCH v2 07/11] xfsprogs: change nftw64 to nftw Jan Tulak
2015-09-09 10:11       ` Jan Tulak
2015-09-09 10:14       ` [PATCH v3 " Jan Tulak
2015-08-26 12:02   ` [PATCH 08/11] xfsprogs: Add a timer implementation for OS X Jan Tulak
2015-08-31 19:00     ` Christoph Hellwig
2015-09-02 10:54       ` Jan Tulak
2015-08-26 12:02   ` [PATCH 09/11] xfsprogs: Add statvfs64 for osx Jan Tulak
2015-09-08 14:24     ` [PATCH 09/11 v2] " Jan Tulak
2015-08-26 12:02   ` [PATCH 10/11] xfsprogs: add dummy mntent for OS X Jan Tulak
2015-08-31 19:01     ` Christoph Hellwig
2015-09-03  9:01       ` Jan Tulak
2015-09-03 10:33         ` Dave Chinner
2015-09-03 10:37           ` Jan Tulak
2015-09-08 14:23     ` [PATCH 10/11 v2] xfsprogs: make fsr use mntinfo when there is no mntent Jan Tulak
2015-08-26 12:02   ` [PATCH 11/11] xfsprogs: add dummy mremap for OS X Jan Tulak
2015-08-31 19:01     ` Christoph Hellwig
2015-09-03 10:35     ` Jan Tulak [this message]
2015-08-31 18:57   ` [PATCH 01/11] xfsprogs: Add a way to compile without blkid Christoph Hellwig

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=1441276510-23637-1-git-send-email-jtulak@redhat.com \
    --to=jtulak@redhat.com \
    --cc=hch@infradead.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