mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
builder: Disable internal parallel xzcat on RHEL 6.
This commit is contained in:
@@ -36,6 +36,10 @@
|
||||
|
||||
#include "ignore-value.h"
|
||||
|
||||
#if HAVE_LIBLZMA
|
||||
#include <lzma.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAML_UNIXSUPPORT_H
|
||||
#include <caml/unixsupport.h>
|
||||
#else
|
||||
@@ -43,18 +47,24 @@
|
||||
extern void unix_error (int errcode, char * cmdname, value arg) Noreturn;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
#include <lzma.h>
|
||||
|
||||
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
|
||||
#if defined (HAVE_LIBLZMA) && \
|
||||
defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \
|
||||
defined (HAVE_LZMA_INDEX_STREAM_PADDING)
|
||||
#define PARALLEL_XZCAT 1
|
||||
#else
|
||||
#define PARALLEL_XZCAT 0
|
||||
#endif
|
||||
|
||||
#if PARALLEL_XZCAT
|
||||
static void pxzcat (value filenamev, value outputfilev, unsigned nr_threads);
|
||||
#endif /* PARALLEL_XZCAT */
|
||||
|
||||
value
|
||||
virt_builder_pxzcat (value inputfilev, value outputfilev)
|
||||
{
|
||||
CAMLparam2 (inputfilev, outputfilev);
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
#if PARALLEL_XZCAT
|
||||
|
||||
/* Parallel implementation of xzcat (pxzcat). */
|
||||
/* XXX Make number of threads configurable? */
|
||||
@@ -73,7 +83,7 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
|
||||
*/
|
||||
pxzcat (inputfilev, outputfilev, nr_threads);
|
||||
|
||||
#else
|
||||
#else /* !PARALLEL_XZCAT */
|
||||
|
||||
/* Fallback: use regular xzcat. */
|
||||
int fd;
|
||||
@@ -105,12 +115,12 @@ virt_builder_pxzcat (value inputfilev, value outputfilev)
|
||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
|
||||
caml_failwith (XZCAT " program failed, see earlier error messages");
|
||||
|
||||
#endif
|
||||
#endif /* !PARALLEL_XZCAT */
|
||||
|
||||
CAMLreturn (Val_unit);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBLZMA
|
||||
#if PARALLEL_XZCAT
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
@@ -649,4 +659,4 @@ worker_thread (void *vp)
|
||||
return &state->status;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBLZMA */
|
||||
#endif /* PARALLEL_XZCAT */
|
||||
|
||||
@@ -677,10 +677,16 @@ test "x$XZCAT" = "xno" && AC_MSG_ERROR([xzcat must be installed])
|
||||
AC_DEFINE_UNQUOTED([XZCAT],["$XZCAT"],[Name of xzcat program.])
|
||||
|
||||
dnl liblzma can be used by virt-builder (optional).
|
||||
PKG_CHECK_MODULES([LIBLZMA], [liblzma],[
|
||||
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [
|
||||
AC_SUBST([LIBLZMA_CFLAGS])
|
||||
AC_SUBST([LIBLZMA_LIBS])
|
||||
AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.])
|
||||
|
||||
dnl Old lzma in RHEL 6 didn't have some APIs we need.
|
||||
old_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBLZMA_LIBS"
|
||||
AC_CHECK_FUNCS([lzma_index_stream_flags lzma_index_stream_padding])
|
||||
LIBS="$old_LIBS"
|
||||
],
|
||||
[AC_MSG_WARN([liblzma not found, virt-builder will be slower])])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user