]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
compressor: conditionalize on HAVE_LZ4
authorKefu Chai <kchai@redhat.com>
Thu, 17 Aug 2017 07:12:22 +0000 (15:12 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 17 Aug 2017 07:12:25 +0000 (15:12 +0800)
do not enable lz4 compressor plugin unless HAVE_LZ4 is ON. so, for
example, when the compressor type is "random", the compressor factory
won't complain with:

load failed dlopen(): "/usr/lib64/ceph/compressor/libceph_lz4.so: cannot
open shared object file: No such file or directory"

anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/compressor/Compressor.cc
src/compressor/Compressor.h

index e07fc8dde94a9bb14bc60a93890f37fb014fc7b4..02764f400f8b5921ef3f7006309f47e058084508 100644 (file)
@@ -27,7 +27,9 @@ const char * Compressor::get_comp_alg_name(int a) {
   case COMP_ALG_SNAPPY: return "snappy";
   case COMP_ALG_ZLIB: return "zlib";
   case COMP_ALG_ZSTD: return "zstd";
+#ifdef HAVE_LZ4
   case COMP_ALG_LZ4: return "lz4";
+#endif
   default: return "???";
   }
 }
@@ -39,8 +41,10 @@ boost::optional<Compressor::CompressionAlgorithm> Compressor::get_comp_alg_type(
     return COMP_ALG_ZLIB;
   if (s == "zstd")
     return COMP_ALG_ZSTD;
+#ifdef HAVE_LZ4
   if (s == "lz4")
     return COMP_ALG_LZ4;
+#endif
   if (s == "" || s == "none")
     return COMP_ALG_NONE;
 
index fec82d44c5d305ccbdfa8b57f7684dc5df66b0d7..dba8f3460fea915c2ca06d851f7c719de310bb1f 100644 (file)
@@ -34,7 +34,9 @@ public:
     COMP_ALG_SNAPPY = 1,
     COMP_ALG_ZLIB = 2,
     COMP_ALG_ZSTD = 3,
+#ifdef HAVE_LZ4
     COMP_ALG_LZ4 = 4,
+#endif
     COMP_ALG_LAST      //the last value for range checks
   };
   // compression options