All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH] libfsimage: add ext4 support for CentOS 5.x
Date: Wed, 5 Sep 2012 14:03:22 +0200	[thread overview]
Message-ID: <1346846602-1109-1-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <20120905030239.GJ8912@reaktio.net>

CentOS 5.x forked e2fs ext4 support into a different package called
e4fs, and so headers and library names changed from ext2fs to ext4fs.
Check if ext4fs/ext2fs.h and -lext4fs work, and use that instead of
ext2fs to build libfsimage. This patch assumes that if the ext4fs
library is present it should always be used instead of ext2fs.

This patch includes a rework of the ext2fs check, a new ext4fs check
and a minor modification in libfsimage to use the correct library.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
Please re-run autogen.sh after applying
---
 config/Tools.mk.in                       |    2 +-
 tools/config.h.in                        |    3 +++
 tools/configure.ac                       |    4 ++--
 tools/libfsimage/Makefile                |    2 +-
 tools/libfsimage/ext2fs-lib/Makefile     |    5 ++++-
 tools/libfsimage/ext2fs-lib/ext2fs-lib.c |    5 ++++-
 tools/m4/extfs.m4                        |   20 ++++++++++++++++++++
 7 files changed, 35 insertions(+), 6 deletions(-)
 create mode 100644 tools/m4/extfs.m4

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 8a52bcc..0859b36 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -56,5 +56,5 @@ CONFIG_SYSTEM_LIBAIO:= @system_aio@
 ZLIB                := @zlib@
 CONFIG_LIBICONV     := @libiconv@
 CONFIG_GCRYPT       := @libgcrypt@
-CONFIG_EXT2FS       := @libext2fs@
+EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
diff --git a/tools/config.h.in b/tools/config.h.in
index bc1ed10..ab726f6 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -45,6 +45,9 @@
 /* libutil header file name */
 #undef INCLUDE_LIBUTIL_H
 
+/* e2fs/e4fs header file name */
+#undef INCLUDE_EXTFS_H
+
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
diff --git a/tools/configure.ac b/tools/configure.ac
index bb497cc..938bc8b 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -35,6 +35,7 @@ m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
 m4_include([m4/pthread.m4])
 m4_include([m4/ptyfuncs.m4])
+m4_include([m4/extfs.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -138,8 +139,7 @@ AC_SUBST(zlib)
 AC_CHECK_LIB([aio], [io_setup], [system_aio="y"], [system_aio="n"])
 AC_SUBST(system_aio)
 AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])])
-AC_CHECK_LIB([ext2fs], [ext2fs_open2], [libext2fs="y"], [libext2fs="n"])
-AC_SUBST(libext2fs)
+AX_CHECK_EXTFS
 AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
 AC_SUBST(libgcrypt)
 AX_CHECK_PTHREAD
diff --git a/tools/libfsimage/Makefile b/tools/libfsimage/Makefile
index 5a506f3..69fd18a 100644
--- a/tools/libfsimage/Makefile
+++ b/tools/libfsimage/Makefile
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y = common ufs reiserfs iso9660 fat zfs
 SUBDIRS-$(CONFIG_X86) += xfs
-ifeq ($(CONFIG_EXT2FS), y)
+ifneq ($(EXTFS_LIBS), )
     SUBDIRS-y += ext2fs-lib
 else
     SUBDIRS-y += ext2fs
diff --git a/tools/libfsimage/ext2fs-lib/Makefile b/tools/libfsimage/ext2fs-lib/Makefile
index 142207f..671fbff 100644
--- a/tools/libfsimage/ext2fs-lib/Makefile
+++ b/tools/libfsimage/ext2fs-lib/Makefile
@@ -4,7 +4,10 @@ LIB_SRCS-y = ext2fs-lib.c
 
 FS = ext2fs-lib
 
-FS_LIBDEPS = -lext2fs
+FS_LIBDEPS = $(EXTFS_LIBS)
+
+# Include configure output (config.h) to headers search path
+CFLAGS += -I$(XEN_ROOT)/tools
 
 .PHONY: all
 all: fs-all
diff --git a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c
index 36a27dc..ed47146 100644
--- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c
+++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c
@@ -21,8 +21,11 @@
  * Use is subject to license terms.
  */
 
+/* Include output from configure */
+#include <config.h>
+
 #include <fsimage_plugin.h>
-#include <ext2fs/ext2fs.h>
+#include INCLUDE_EXTFS_H
 #include <errno.h>
 #include <inttypes.h>
 
diff --git a/tools/m4/extfs.m4 b/tools/m4/extfs.m4
new file mode 100644
index 0000000..7309da9
--- /dev/null
+++ b/tools/m4/extfs.m4
@@ -0,0 +1,20 @@
+AC_DEFUN([AX_CHECK_EXTFS], [
+AC_CHECK_HEADER([ext2fs/ext2fs.h], [
+AC_CHECK_LIB([ext2fs], [ext2fs_open2], [
+    AC_DEFINE([INCLUDE_EXTFS_H], [<ext2fs/ext2fs.h>],
+              [Define extfs header to use])
+    EXTFS_LIBS="-lext2fs"
+])
+])
+dnl This is a temporary hack for CentOS 5.x, which split the ext4 support
+dnl of ext2fs in a different package. Once CentOS 5.x is no longer supported
+dnl we can remove this.
+AC_CHECK_HEADER([ext4fs/ext2fs.h], [
+AC_CHECK_LIB([ext4fs], [ext2fs_open2], [
+    AC_DEFINE([INCLUDE_EXTFS_H], [<ext4fs/ext2fs.h>],
+              [Define extfs header to use])
+    EXTFS_LIBS="-lext4fs"
+])
+])
+AC_SUBST(EXTFS_LIBS)
+])
-- 
1.7.7.5 (Apple Git-26)

  parent reply	other threads:[~2012-09-05 12:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05  3:02 Xen 4.2 (missing) pygrub support for ext4 on rhel5/centos5 e4fsprogs Pasi Kärkkäinen
2012-09-05  9:05 ` Andrew Cooper
2012-09-05 12:03 ` Roger Pau Monne [this message]
2012-09-05 18:04   ` [PATCH] libfsimage: add ext4 support for CentOS 5.x Ian Campbell
2012-09-05 20:55     ` Pasi Kärkkäinen
2012-09-06  7:23       ` Ian Campbell
2012-09-06 14:39         ` Pasi Kärkkäinen
2012-09-14  9:05   ` Ian Campbell
2012-09-14 10:19     ` Roger Pau Monne
2012-09-14 10:21       ` Ian Campbell
2012-10-14 11:10     ` [PATCH] libfsimage: add ext4 support for CentOS 5.x / Xen 4.2.1 backport Pasi Kärkkäinen
2012-10-14 11:26       ` Steven Haigh
2012-10-15  7:52       ` Ian Campbell
2012-10-15 13:12         ` Pasi Kärkkäinen

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=1346846602-1109-1-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.