Patchwork [v6,05/11] dump: add support for lzo/snappy

login
register
mail settings
Submitter Qiao Nuohan
Date Jan. 5, 2014, 7:27 a.m.
Message ID <1388906864-1083-6-git-send-email-qiaonuohan@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/306922/
State New
Headers show

Comments

Qiao Nuohan - Jan. 5, 2014, 7:27 a.m.
kdump-compressed format supports three compression format, zlib/lzo/snappy.
Currently, only zlib is available. This patch is used to support lzo/snappy.
'--enable-lzo/--enable-snappy' is needed to be specified with configure to make
lzo/snappy available for qemu

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
---
 configure |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)
Laszlo Ersek - Jan. 6, 2014, 7:25 p.m.
On 01/05/14 08:27, Qiao Nuohan wrote:
> kdump-compressed format supports three compression format, zlib/lzo/snappy.
> Currently, only zlib is available. This patch is used to support lzo/snappy.
> '--enable-lzo/--enable-snappy' is needed to be specified with configure to make
> lzo/snappy available for qemu
> 
> Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
> ---
>  configure |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 50 insertions(+), 0 deletions(-)
> 
> diff --git a/configure b/configure
> index edfea95..b7a28b7 100755
> --- a/configure
> +++ b/configure
> @@ -245,6 +245,8 @@ libusb=""
>  usb_redir=""
>  glx=""
>  zlib="yes"
> +lzo="no"
> +snappy="no"
>  guest_agent=""
>  guest_agent_with_vss="no"
>  vss_win32_sdk=""
> @@ -947,6 +949,10 @@ for opt do
>    ;;
>    --disable-zlib-test) zlib="no"
>    ;;
> +  --enable-lzo) lzo="yes"
> +  ;;
> +  --enable-snappy) snappy="yes"
> +  ;;
>    --enable-guest-agent) guest_agent="yes"
>    ;;
>    --disable-guest-agent) guest_agent="no"
> @@ -1538,6 +1544,42 @@ fi
>  libs_softmmu="$libs_softmmu -lz"
>  
>  ##########################################
> +# lzo check
> +
> +if test "$lzo" != "no" ; then
> +    cat > $TMPC << EOF
> +#include <lzo/lzo1x.h>
> +int main(void) { lzo_version(); return 0; }
> +EOF
> +    if compile_prog "" "-llzo2" ; then
> +        :
> +    else
> +        error_exit "lzo check failed" \
> +            "Make sure to have the lzo libs and headers installed."
> +    fi
> +
> +    libs_softmmu="$libs_softmmu -llzo2"
> +fi
> +
> +##########################################
> +# snappy check
> +
> +if test "$snappy" != "no" ; then
> +    cat > $TMPC << EOF
> +#include <snappy-c.h>
> +int main(void) { snappy_max_compressed_length(4096); return 0; }
> +EOF
> +    if compile_prog "" "-lsnappy" ; then
> +        :
> +    else
> +        error_exit "snappy check failed" \
> +            "Make sure to have the snappy libs and headers installed."
> +    fi
> +
> +    libs_softmmu="$libs_softmmu -lsnappy"
> +fi
> +
> +##########################################
>  # libseccomp check
>  
>  if test "$seccomp" != "no" ; then
> @@ -4135,6 +4177,14 @@ if test "$glx" = "yes" ; then
>    echo "GLX_LIBS=$glx_libs" >> $config_host_mak
>  fi
>  
> +if test "$lzo" = "yes" ; then
> +  echo "CONFIG_LZO=y" >> $config_host_mak
> +fi
> +
> +if test "$snappy" = "yes" ; then
> +  echo "CONFIG_SNAPPY=y" >> $config_host_mak
> +fi
> +
>  if test "$libiscsi" = "yes" ; then
>    echo "CONFIG_LIBISCSI=y" >> $config_host_mak
>  fi
> 

You could have displayed the lzo / snappy settings along with the other
settings in the "big echo block". But it's not too important; if you
want you can add it later.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Qiao Nuohan - Jan. 7, 2014, 6:25 a.m.
On 01/07/2014 03:25 AM, Laszlo Ersek wrote:
> You could have displayed the lzo / snappy settings along with the other
> settings in the "big echo block". But it's not too important; if you
> want you can add it later.

You mean the following part? Thanks for pointing it out.

<cut>
echo "Standard options:"
echo "  --help                   print this message"
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
echo "                           use %M for cpu name [$interp_prefix]"
echo "  --target-list=LIST       set target list (default: build everything)"
echo "Available targets: $default_target_list" | \
     fold -s -w 53 | sed -e 's/^/                           /'
echo ""
echo "Advanced options (experts only):"
echo "  --source-path=PATH       path of source code [$source_path]"
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
echo "  --cc=CC                  use C compiler CC [$cc]"
...
<cut>
Laszlo Ersek - Jan. 7, 2014, 7:24 a.m.
On 01/07/14 07:25, Qiao Nuohan wrote:
> On 01/07/2014 03:25 AM, Laszlo Ersek wrote:
>> You could have displayed the lzo / snappy settings along with the other
>> settings in the "big echo block". But it's not too important; if you
>> want you can add it later.
> 
> You mean the following part? Thanks for pointing it out.
> 
> <cut>
> echo "Standard options:"
> echo "  --help                   print this message"
> echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
> echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
> echo "                           use %M for cpu name [$interp_prefix]"
> echo "  --target-list=LIST       set target list (default: build
> everything)"
> echo "Available targets: $default_target_list" | \
>     fold -s -w 53 | sed -e 's/^/                           /'
> echo ""
> echo "Advanced options (experts only):"
> echo "  --source-path=PATH       path of source code [$source_path]"
> echo "  --cross-prefix=PREFIX    use PREFIX for compile tools
> [$cross_prefix]"
> echo "  --cc=CC                  use C compiler CC [$cc]"
> ...
> <cut>
> 

This is the help text, I didn't mean that.

I meant this output, printed after configure finishes:

-------------------
Install prefix    /opt/qemu-installed
BIOS directory    /opt/qemu-installed/share/qemu
binary directory  /opt/qemu-installed/bin
[...]
libssh2 support   no
TPM passthrough   no
QOM debugging     yes
vhdx              yes
-------------------

Thanks
Laszlo

Patch

diff --git a/configure b/configure
index edfea95..b7a28b7 100755
--- a/configure
+++ b/configure
@@ -245,6 +245,8 @@  libusb=""
 usb_redir=""
 glx=""
 zlib="yes"
+lzo="no"
+snappy="no"
 guest_agent=""
 guest_agent_with_vss="no"
 vss_win32_sdk=""
@@ -947,6 +949,10 @@  for opt do
   ;;
   --disable-zlib-test) zlib="no"
   ;;
+  --enable-lzo) lzo="yes"
+  ;;
+  --enable-snappy) snappy="yes"
+  ;;
   --enable-guest-agent) guest_agent="yes"
   ;;
   --disable-guest-agent) guest_agent="no"
@@ -1538,6 +1544,42 @@  fi
 libs_softmmu="$libs_softmmu -lz"
 
 ##########################################
+# lzo check
+
+if test "$lzo" != "no" ; then
+    cat > $TMPC << EOF
+#include <lzo/lzo1x.h>
+int main(void) { lzo_version(); return 0; }
+EOF
+    if compile_prog "" "-llzo2" ; then
+        :
+    else
+        error_exit "lzo check failed" \
+            "Make sure to have the lzo libs and headers installed."
+    fi
+
+    libs_softmmu="$libs_softmmu -llzo2"
+fi
+
+##########################################
+# snappy check
+
+if test "$snappy" != "no" ; then
+    cat > $TMPC << EOF
+#include <snappy-c.h>
+int main(void) { snappy_max_compressed_length(4096); return 0; }
+EOF
+    if compile_prog "" "-lsnappy" ; then
+        :
+    else
+        error_exit "snappy check failed" \
+            "Make sure to have the snappy libs and headers installed."
+    fi
+
+    libs_softmmu="$libs_softmmu -lsnappy"
+fi
+
+##########################################
 # libseccomp check
 
 if test "$seccomp" != "no" ; then
@@ -4135,6 +4177,14 @@  if test "$glx" = "yes" ; then
   echo "GLX_LIBS=$glx_libs" >> $config_host_mak
 fi
 
+if test "$lzo" = "yes" ; then
+  echo "CONFIG_LZO=y" >> $config_host_mak
+fi
+
+if test "$snappy" = "yes" ; then
+  echo "CONFIG_SNAPPY=y" >> $config_host_mak
+fi
+
 if test "$libiscsi" = "yes" ; then
   echo "CONFIG_LIBISCSI=y" >> $config_host_mak
 fi