From: Jan Tulak <jtulak@redhat.com>
To: xfs@oss.sgi.com
Cc: Jan Tulak <jtulak@redhat.com>
Subject: [PATCH 01/14] xfsprogs: Add a way to compile without blkid
Date: Tue, 15 Sep 2015 11:59:11 +0200 [thread overview]
Message-ID: <1442311164-12921-2-git-send-email-jtulak@redhat.com> (raw)
In-Reply-To: <1442311164-12921-1-git-send-email-jtulak@redhat.com>
Because not all platforms have up-to-date blkid with required
functions, allow at least partial functionality by adding
--enable-blkid=yes/no optional configure argument.
When blkid is disabled, signature detection and device geometry
detection doesn't work.
Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
configure.ac | 10 +++++++++-
include/builddefs.in | 5 +++++
mkfs/xfs_mkfs.c | 37 ++++++++++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 16f3f68..aa241cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,11 @@ AC_ARG_ENABLE(gettext,
enable_gettext=yes)
AC_SUBST(enable_gettext)
+AC_ARG_ENABLE(blkid,
+[ --enable-blkid=[yes/no] Enable use of block device id library [default=yes]],,
+ enable_blkid=yes)
+AC_SUBST(enable_blkid)
+
AC_ARG_ENABLE(readline,
[ --enable-readline=[yes/no] Enable readline command editing [default=no]],
test $enable_readline = yes && libreadline="-lreadline",
@@ -117,9 +122,12 @@ AC_HAVE_PREADV
AC_HAVE_SYNC_FILE_RANGE
AC_HAVE_MNTENT
AC_HAVE_FLS
-AC_HAVE_BLKID_TOPO
AC_HAVE_READDIR
+if test "$enable_blkid" = yes; then
+AC_HAVE_BLKID_TOPO
+fi
+
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([char *])
AC_TYPE_UMODE_T
diff --git a/include/builddefs.in b/include/builddefs.in
index 8851956..6c16a65 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -89,6 +89,7 @@ ENABLE_SHARED = @enable_shared@
ENABLE_GETTEXT = @enable_gettext@
ENABLE_EDITLINE = @enable_editline@
ENABLE_READLINE = @enable_readline@
+ENABLE_BLKID = @enable_blkid@
HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
@@ -138,6 +139,10 @@ endif
ifeq ($(HAVE_MNTENT),yes)
PCFLAGS+= -DHAVE_MNTENT
endif
+ifeq ($(ENABLE_BLKID),yes)
+PCFLAGS+= -DENABLE_BLKID
+endif
+
GCFLAGS = $(OPTIMIZER) $(DEBUG) \
-DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\" \
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index d993fc0..5964eaf 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -18,7 +18,9 @@
#include "libxfs.h"
#include <ctype.h>
-#include <blkid/blkid.h>
+#ifdef ENABLE_BLKID
+# include <blkid/blkid.h>
+#endif /* ENABLE_BLKID */
#include "xfs_mkfs.h"
/*
@@ -298,6 +300,7 @@ calc_stripe_factors(
* 0 for nothing found
* -1 for internal error
*/
+#ifdef ENABLE_BLKID
static int
check_overwrite(
char *device)
@@ -451,6 +454,38 @@ out_free_probe:
_("warning: unable to probe device topology for device %s\n"),
device);
}
+#else /* ifdef ENABLE_BLKID */
+/*
+ * Without blkid, we can't do a good check for signatures.
+ * So instead of some messy attempts, just disable any checks
+ * and always return 'nothing found'.
+ */
+# warning BLKID is disabled, so signature detection and block device\
+ access are not working!
+static int
+check_overwrite(
+ char *device)
+{
+ return 1;
+}
+
+static void blkid_get_topology(
+ const char *device,
+ int *sunit,
+ int *swidth,
+ int *lsectorsize,
+ int *psectorsize,
+ int force_overwrite)
+{
+ /*
+ * Shouldn't make any difference (no blkid = no block device access),
+ * but make sure this dummy replacement returns with at least some
+ * sanity.
+ */
+ *lsectorsize = *psectorsize = 512;
+}
+
+#endif /* ENABLE_BLKID */
static void get_topology(
libxfs_init_t *xi,
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-09-15 9:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-15 9:59 [PATCH 00/14 v5] xfsprogs: Partial OSX support Jan Tulak
2015-09-15 9:59 ` Jan Tulak [this message]
2015-09-15 9:59 ` [PATCH 02/14] xfsprogs: Add XATTR_LIST_MAX to OS X headers Jan Tulak
2015-09-15 9:59 ` [PATCH 03/14] xfsprogs: avoid dependency on Linux XATTR_SIZE_MAX Jan Tulak
2015-09-23 3:09 ` Dave Chinner
2015-09-15 9:59 ` [PATCH 04/14] xfsprogs: prefix XATTR_LIST_MAX with XFS_ Jan Tulak
2015-09-23 3:15 ` Dave Chinner
2015-09-24 8:28 ` Jan Tulak
2015-09-24 22:41 ` Dave Chinner
2015-10-07 11:17 ` [PATCH 04/14 v2] " Jan Tulak
2015-09-15 9:59 ` [PATCH 05/14] xfsprogs: Add includes required for OS X builds (delta) Jan Tulak
2015-09-15 9:59 ` [PATCH 06/14] xfsprogs: Add autoconf check for fsetxattr call Jan Tulak
2015-09-15 9:59 ` [PATCH 07/14] xfsprogs: uuid changes for OS X Jan Tulak
2015-09-15 9:59 ` [PATCH 08/14] xfsprogs: Remove conflicting define " Jan Tulak
2015-09-15 9:59 ` [PATCH 09/14] xfsprogs: change nftw64 to nftw Jan Tulak
2015-09-15 9:59 ` [PATCH 10/14] xfsprogs: Add a timer implementation for OS X Jan Tulak
2015-09-23 3:25 ` Dave Chinner
2015-09-24 9:26 ` Jan Tulak
2015-09-30 8:23 ` [PATCH 10/14 v2] " Jan Tulak
2015-09-15 9:59 ` [PATCH 11/14] xfsprogs: Add statvfs64 for osx Jan Tulak
2015-09-23 3:32 ` Dave Chinner
2015-09-24 9:33 ` Jan Tulak
2015-09-30 8:21 ` [PATCH 11/14 v2] " Jan Tulak
2015-09-15 9:59 ` [PATCH 12/14] xfsprogs: make fsr use mntinfo when there is no mntent Jan Tulak
2015-09-23 3:36 ` Dave Chinner
2015-09-24 14:38 ` Jan Tulak
2015-09-24 22:53 ` Dave Chinner
2015-09-29 16:07 ` Jan Tulak
2015-09-29 16:04 ` [PATCH 12/14 v2] " Jan Tulak
2015-10-13 4:54 ` Dave Chinner
2015-10-13 8:45 ` Jan Tulak
2015-10-13 9:56 ` [PATCH 12/14 v3] " Jan Tulak
2015-09-15 9:59 ` [PATCH 13/14] xfsprogs: Make mremap conditional Jan Tulak
2015-10-13 4:42 ` Dave Chinner
2015-09-15 9:59 ` [PATCH 14/14] xfsprogs: rename lstat64 to lstat for OS X Jan Tulak
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=1442311164-12921-2-git-send-email-jtulak@redhat.com \
--to=jtulak@redhat.com \
--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