[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.2-testing] libfsimage: add ext4 support for CentOS 5.x


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-4.2-testing <patchbot@xxxxxxx>
  • Date: Fri, 02 Nov 2012 05:11:22 +0000
  • Delivery-date: Fri, 02 Nov 2012 05:11:27 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxx>
# Date 1351267342 -3600
# Node ID 9ebebb1904fd540ddfb974647b8d97208db37c23
# Parent  9a51ab6d2d07d0e8e09085782761681ae5fcaf5e
libfsimage: add ext4 support for CentOS 5.x

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@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

xen-unstable changeset: 25895:98e1ba6a672a
Backport-requested-by: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 9a51ab6d2d07 -r 9ebebb1904fd config/Tools.mk.in
--- a/config/Tools.mk.in        Fri Oct 26 17:01:36 2012 +0100
+++ b/config/Tools.mk.in        Fri Oct 26 17:02:22 2012 +0100
@@ -57,5 +57,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 -r 9a51ab6d2d07 -r 9ebebb1904fd tools/config.h.in
--- a/tools/config.h.in Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/config.h.in Fri Oct 26 17:02:22 2012 +0100
@@ -42,6 +42,9 @@
 /* Define curses header to use */
 #undef INCLUDE_CURSES_H
 
+/* Define extfs header to use */
+#undef INCLUDE_EXTFS_H
+
 /* libutil header file name */
 #undef INCLUDE_LIBUTIL_H
 
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/configure
--- a/tools/configure   Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/configure   Fri Oct 26 17:02:22 2012 +0100
@@ -603,7 +603,7 @@ PTHREAD_LIBS
 PTHREAD_LDFLAGS
 PTHREAD_CFLAGS
 libgcrypt
-libext2fs
+EXTFS_LIBS
 system_aio
 zlib
 glib_LIBS
@@ -2389,6 +2389,8 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+
+
 # Enable/disable options
 
 # Check whether --enable-githttp was given.
@@ -6325,6 +6327,10 @@ else
   as_fn_error $? "Could not find libcrypto" "$LINENO" 5
 fi
 
+
+ac_fn_c_check_header_mongrel "$LINENO" "ext2fs/ext2fs.h" 
"ac_cv_header_ext2fs_ext2fs_h" "$ac_includes_default"
+if test "x$ac_cv_header_ext2fs_ext2fs_h" = x""yes; then :
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ext2fs_open2 in 
-lext2fs" >&5
 $as_echo_n "checking for ext2fs_open2 in -lext2fs... " >&6; }
 if test "${ac_cv_lib_ext2fs_ext2fs_open2+set}" = set; then :
@@ -6362,10 +6368,70 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_ext2fs_ext2fs_open2" >&5
 $as_echo "$ac_cv_lib_ext2fs_ext2fs_open2" >&6; }
 if test "x$ac_cv_lib_ext2fs_ext2fs_open2" = x""yes; then :
-  libext2fs="y"
-else
-  libext2fs="n"
-fi
+
+
+$as_echo "#define INCLUDE_EXTFS_H <ext2fs/ext2fs.h>" >>confdefs.h
+
+    EXTFS_LIBS="-lext2fs"
+
+fi
+
+
+fi
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "ext4fs/ext2fs.h" 
"ac_cv_header_ext4fs_ext2fs_h" "$ac_includes_default"
+if test "x$ac_cv_header_ext4fs_ext2fs_h" = x""yes; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ext2fs_open2 in 
-lext4fs" >&5
+$as_echo_n "checking for ext2fs_open2 in -lext4fs... " >&6; }
+if test "${ac_cv_lib_ext4fs_ext2fs_open2+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lext4fs  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ext2fs_open2 ();
+int
+main ()
+{
+return ext2fs_open2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ext4fs_ext2fs_open2=yes
+else
+  ac_cv_lib_ext4fs_ext2fs_open2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_ext4fs_ext2fs_open2" >&5
+$as_echo "$ac_cv_lib_ext4fs_ext2fs_open2" >&6; }
+if test "x$ac_cv_lib_ext4fs_ext2fs_open2" = x""yes; then :
+
+
+$as_echo "#define INCLUDE_EXTFS_H <ext4fs/ext2fs.h>" >>confdefs.h
+
+    EXTFS_LIBS="-lext4fs"
+
+fi
+
+
+fi
+
+
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_md_hash_buffer in 
-lgcrypt" >&5
diff -r 9a51ab6d2d07 -r 9ebebb1904fd tools/configure.ac
--- a/tools/configure.ac        Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/configure.ac        Fri Oct 26 17:02:22 2012 +0100
@@ -34,6 +34,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])
@@ -131,8 +132,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 -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/Makefile
--- a/tools/libfsimage/Makefile Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/Makefile Fri Oct 26 17:02:22 2012 +0100
@@ -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 -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile      Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile      Fri Oct 26 17:02:22 2012 +0100
@@ -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 -r 9a51ab6d2d07 -r 9ebebb1904fd tools/libfsimage/ext2fs-lib/ext2fs-lib.c
--- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c  Fri Oct 26 17:01:36 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c  Fri Oct 26 17:02:22 2012 +0100
@@ -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 -r 9a51ab6d2d07 -r 9ebebb1904fd tools/m4/extfs.m4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/extfs.m4 Fri Oct 26 17:02:22 2012 +0100
@@ -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)
+])

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.