]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: implement consistent error stream 4708/head
authorLoic Dachary <ldachary@redhat.com>
Sun, 17 May 2015 13:28:52 +0000 (15:28 +0200)
committerLoic Dachary <ldachary@redhat.com>
Mon, 25 May 2015 14:59:02 +0000 (16:59 +0200)
The error stream in the erasure code path is broken and the error
message is sometime not reported back to the user. For instance the
ErasureCodePlugin::factory method has no error stream: when an error
happens the user is left with a cryptic error code that needs lookup in
the sources to figure it out.

The error stream is made more systematic by:

  * always pass it as ostream *ss (instead of something passing it as
    a reference and sometime as a stringstream)

  * ostream *ss is added to ErasureCodePlugin::factory

  * define the ErasureCodeInterface::init pure virtual. It is
    already implemented by all plugins, only in slightly different
    ways. The ostream *ss is added so the init function has a way to
    report error in a human readable way to the caller, in addition to
    the error code.

The ErasureCodePluginJerasure::init return value was incorrectly ignored
when called from ErasureCodePluginJerasure::factory and now returns when
it fails.

The ErasureCodeLrc::layers_init method is given ostream *ss for error
messages instead of printing them via derr.

The ErasureCodePluginLrc::factory method no longer prints errors via
derr: this workaround is made unnecessary by the ostream *ss argument.

The ErasureCodeShec::init ostream *ss argument is ignored. The
ErasureCodeShec::parse method entirely relies on derr to report errors
and converting it goes beyond the scope of this cleanup. There is a
slight risk of getting it wrong and it deserves a separate commit and
careful and independent review.

The PGBackend, OSDMonitor.{cc,h} changes are only about prototype
changes.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
35 files changed:
src/ceph_mon.cc
src/ceph_osd.cc
src/erasure-code/ErasureCodeInterface.h
src/erasure-code/ErasureCodePlugin.cc
src/erasure-code/ErasureCodePlugin.h
src/erasure-code/isa/ErasureCodeIsa.cc
src/erasure-code/isa/ErasureCodeIsa.h
src/erasure-code/isa/ErasureCodePluginIsa.cc
src/erasure-code/jerasure/ErasureCodeJerasure.cc
src/erasure-code/jerasure/ErasureCodeJerasure.h
src/erasure-code/jerasure/ErasureCodePluginJerasure.cc
src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc
src/erasure-code/lrc/ErasureCodeLrc.cc
src/erasure-code/lrc/ErasureCodeLrc.h
src/erasure-code/lrc/ErasureCodePluginLrc.cc
src/erasure-code/shec/ErasureCodePluginShec.cc
src/erasure-code/shec/ErasureCodeShec.cc
src/erasure-code/shec/ErasureCodeShec.h
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/osd/PGBackend.cc
src/test/erasure-code/ErasureCodeExample.h
src/test/erasure-code/ErasureCodePluginExample.cc
src/test/erasure-code/TestErasureCode.cc
src/test/erasure-code/TestErasureCodeIsa.cc
src/test/erasure-code/TestErasureCodeJerasure.cc
src/test/erasure-code/TestErasureCodeLrc.cc
src/test/erasure-code/TestErasureCodePlugin.cc
src/test/erasure-code/TestErasureCodePluginIsa.cc
src/test/erasure-code/TestErasureCodePluginJerasure.cc
src/test/erasure-code/TestErasureCodePluginLrc.cc
src/test/erasure-code/TestErasureCodeShec.cc
src/test/erasure-code/TestErasureCodeShec_all.cc
src/test/erasure-code/TestErasureCodeShec_thread.cc
src/test/erasure-code/ceph_erasure_code.cc

index 42c67b58302dda398dd62e716aea15f0650fbe46..dcb07de615dd0382ace8ce5d0862c7be8b6e4e0c 100644 (file)
@@ -193,7 +193,7 @@ int preload_erasure_code()
   stringstream ss;
   int r = ErasureCodePluginRegistry::instance().preload(plugins,
                                                        directory,
-                                                       ss);
+                                                       &ss);
   if (r)
     derr << ss.str() << dendl;
   else
index d893aebd052a04bde13fe1c98e79e5f39c6aaa38..8a7e0c294180bd411245a83ef1875b832823a5f5 100644 (file)
@@ -89,7 +89,7 @@ int preload_erasure_code()
   stringstream ss;
   int r = ErasureCodePluginRegistry::instance().preload(plugins,
                                                        directory,
-                                                       ss);
+                                                       &ss);
   if (r)
     derr << ss.str() << dendl;
   else
index 70e8c6438a67b46dcabaa918b944448b4a904115..1fb962aad5eef4f40e8b72dd1aaf233b6d704dea 100644 (file)
@@ -157,6 +157,22 @@ namespace ceph {
   public:
     virtual ~ErasureCodeInterface() {}
 
+    /**
+     * Initialize the instance according to the content of
+     * **profile**. The **ss** stream is set with debug messages or
+     * error messages, the content of which depend on the
+     * implementation.
+     *
+     * Return 0 on success or a negative errno on error. When
+     * returning on error, the implementation is expected to
+     * provide a human readable explanation in **ss**.
+     *
+     * @param [in] profile a key/value map
+     * @param [out] ss contains informative messages when an error occurs
+     * @return 0 on success or a negative errno on error.
+     */
+    virtual int init(ErasureCodeProfile &profile, ostream *ss) = 0;
+
     /**
      * Create a new ruleset in **crush** under the name **name**,
      * unless it already exists.
index f874357707fcaf633ed97f4f08bbb278a5dc2364..f8f9eec6a1ef573e22d77aa2b2bdf6d7babdd4dc 100644 (file)
@@ -86,7 +86,7 @@ ErasureCodePlugin *ErasureCodePluginRegistry::get(const std::string &name)
 int ErasureCodePluginRegistry::factory(const std::string &plugin_name,
                                       ErasureCodeProfile &profile,
                                       ErasureCodeInterfaceRef *erasure_code,
-                                      ostream &ss)
+                                      ostream *ss)
 {
   ErasureCodePlugin *plugin;
   {
@@ -102,7 +102,7 @@ int ErasureCodePluginRegistry::factory(const std::string &plugin_name,
     }
   }
 
-  return plugin->factory(profile, erasure_code);
+  return plugin->factory(profile, erasure_code, ss);
 }
 
 static const char *an_older_version() {
@@ -112,14 +112,14 @@ static const char *an_older_version() {
 int ErasureCodePluginRegistry::load(const std::string &plugin_name,
                                    const std::string &directory,
                                    ErasureCodePlugin **plugin,
-                                   ostream &ss)
+                                   ostream *ss)
 {
   assert(lock.is_locked());
   std::string fname = directory + "/" PLUGIN_PREFIX
     + plugin_name + PLUGIN_SUFFIX;
   void *library = dlopen(fname.c_str(), RTLD_NOW);
   if (!library) {
-    ss << "load dlopen(" << fname << "): " << dlerror();
+    *ss << "load dlopen(" << fname << "): " << dlerror();
     return -EIO;
   }
 
@@ -128,8 +128,8 @@ int ErasureCodePluginRegistry::load(const std::string &plugin_name,
   if (erasure_code_version == NULL)
     erasure_code_version = an_older_version;
   if (erasure_code_version() != string(CEPH_GIT_NICE_VER)) {
-    ss << "expected plugin " << fname << " version " << CEPH_GIT_NICE_VER
-       << " but it claims to be " << erasure_code_version() << " instead";
+    *ss << "expected plugin " << fname << " version " << CEPH_GIT_NICE_VER
+       << " but it claims to be " << erasure_code_version() << " instead";
     dlclose(library);
     return -EXDEV;
   }
@@ -140,38 +140,38 @@ int ErasureCodePluginRegistry::load(const std::string &plugin_name,
     std::string name = plugin_name;
     int r = erasure_code_init(name.c_str(), directory.c_str());
     if (r != 0) {
-      ss << "erasure_code_init(" << plugin_name
-        << "," << directory 
-        << "): " << cpp_strerror(r);
+      *ss << "erasure_code_init(" << plugin_name
+         << "," << directory
+         << "): " << cpp_strerror(r);
       dlclose(library);
       return r;
     }
   } else {
-    ss << "load dlsym(" << fname
-       << ", " << PLUGIN_INIT_FUNCTION
-       << "): " << dlerror();
+    *ss << "load dlsym(" << fname
+       << ", " << PLUGIN_INIT_FUNCTION
+       << "): " << dlerror();
     dlclose(library);
     return -ENOENT;
   }
 
   *plugin = get(plugin_name);
   if (*plugin == 0) {
-    ss << "load " << PLUGIN_INIT_FUNCTION << "()"
-       << "did not register " << plugin_name;
+    *ss << "load " << PLUGIN_INIT_FUNCTION << "()"
+       << "did not register " << plugin_name;
     dlclose(library);
     return -EBADF;
   }
 
   (*plugin)->library = library;
 
-  ss << __func__ << ": " << plugin_name << " ";
+  *ss << __func__ << ": " << plugin_name << " ";
 
   return 0;
 }
 
 int ErasureCodePluginRegistry::preload(const std::string &plugins,
                                       const std::string &directory,
-                                      ostream &ss)
+                                      ostream *ss)
 {
   Mutex::Locker l(lock);
   list<string> plugins_list;
index 19c4e0ce3a1efa79d1d86b908885aa982d95c1de..9da0a6efcfaa1d8977b767b9d00ca0efabfc3bb0 100644 (file)
@@ -37,7 +37,8 @@ namespace ceph {
     virtual ~ErasureCodePlugin() {}
 
     virtual int factory(ErasureCodeProfile &profile,
-                        ErasureCodeInterfaceRef *erasure_code) = 0;
+                        ErasureCodeInterfaceRef *erasure_code,
+                       ostream *ss) = 0;
   };
 
   class ErasureCodePluginRegistry {
@@ -59,7 +60,7 @@ namespace ceph {
     int factory(const std::string &plugin,
                ErasureCodeProfile &profile,
                ErasureCodeInterfaceRef *erasure_code,
-               ostream &ss);
+               ostream *ss);
 
     int add(const std::string &name, ErasureCodePlugin *plugin);
     int remove(const std::string &name);
@@ -68,11 +69,11 @@ namespace ceph {
     int load(const std::string &plugin_name,
             const std::string &directory,
             ErasureCodePlugin **plugin,
-            ostream &ss);
+            ostream *ss);
 
     int preload(const std::string &plugins,
                const std::string &directory,
-               ostream &ss);
+               ostream *ss);
   };
 }
 
index 2ddb87df475d3ecaf022c2571c89ffca65511abd..697062e9a9192a68a71b22e8de9ad767d74c3bc4 100644 (file)
@@ -63,9 +63,10 @@ ErasureCodeIsa::create_ruleset(const string &name,
 
 // -----------------------------------------------------------------------------
 
-void
-ErasureCodeIsa::init(ErasureCodeProfile &profile)
+int
+ErasureCodeIsa::init(ErasureCodeProfile &profile, ostream *ss)
 {
+  int err = 0;
   dout(10) << "technique=" << technique << dendl;
   map<string, string>::const_iterator parameter;
   parameter = profile.find("ruleset-root");
@@ -74,10 +75,11 @@ ErasureCodeIsa::init(ErasureCodeProfile &profile)
   parameter = profile.find("ruleset-failure-domain");
   if (parameter != profile.end())
     ruleset_failure_domain = parameter->second;
-  ostringstream ss;
-  if (parse(profile, &ss))
-    derr << ss.str() << dendl;
+  err |= parse(profile, ss);
+  if (err)
+    return err;
   prepare();
+  return err;
 }
 
 // -----------------------------------------------------------------------------
index 44c098e6bf231bfd3f6a14ebd2503cb25d525509..764e55a471a773607d1f323957e1285739acc96a 100644 (file)
@@ -91,7 +91,7 @@ public:
                             const map<int, bufferlist> &chunks,
                             map<int, bufferlist> *decoded);
 
-  void init(ErasureCodeProfile &profile);
+  virtual int init(ErasureCodeProfile &profile, ostream *ss);
 
   virtual void isa_encode(char **data,
                           char **coding,
index fd3d7b3da8f5161f7e424deceab4c2fb4198e49f..86aff3ae0e48f541e243aab831c2372967aca26d 100644 (file)
@@ -36,7 +36,8 @@ public:
   ErasureCodeIsaTableCache tcache;
 
   virtual int factory(ErasureCodeProfile &profile,
-                      ErasureCodeInterfaceRef *erasure_code)
+                      ErasureCodeInterfaceRef *erasure_code,
+                      ostream *ss)
   {
     ErasureCodeIsa *interface;
     std::string t = "reed_sol_van";
@@ -50,15 +51,19 @@ public:
         interface = new ErasureCodeIsaDefault(tcache,
                                               ErasureCodeIsaDefault::kCauchy);
       } else {
-        derr << "technique=" << t << " is not a valid coding technique. "
+        *ss << "technique=" << t << " is not a valid coding technique. "
           << " Choose one of the following: "
           << "reed_sol_van,"
-          << "cauchy" << dendl;
+          << "cauchy" << std::endl;
         return -ENOENT;
       }
     }
 
-    interface->init(profile);
+    int r = interface->init(profile, ss);
+    if (r) {
+      delete interface;
+      return r;
+    }
     *erasure_code = ErasureCodeInterfaceRef(interface);
     return 0;
   }
index 9804f0e42bbf55dc12d115ccb74c3e8762f5af28..72bd9b30ea37a31cbe118472e648fa2ca8bb1475 100644 (file)
@@ -52,8 +52,9 @@ int ErasureCodeJerasure::create_ruleset(const string &name,
   }
 }
 
-void ErasureCodeJerasure::init(ErasureCodeProfile& profile)
+int ErasureCodeJerasure::init(ErasureCodeProfile& profile, ostream *ss)
 {
+  int err = 0;
   dout(10) << "technique=" << technique << dendl;
   map<string,string>::const_iterator parameter;
   parameter = profile.find("ruleset-root");
@@ -62,10 +63,11 @@ void ErasureCodeJerasure::init(ErasureCodeProfile& profile)
   parameter = profile.find("ruleset-failure-domain");
   if (parameter != profile.end())
     ruleset_failure_domain = parameter->second;
-  ostringstream ss;
-  if (parse(profile, &ss))
-    derr << ss.str() << dendl;
+  err |= parse(profile, ss);
+  if (err)
+    return err;
   prepare();
+  return err;
 }
 
 int ErasureCodeJerasure::parse(ErasureCodeProfile &profile,
index 436ff3dcc1be44da31550e08d2aea5a7e2afb760..8d9bb6a1cb31f913e494ffd698c6c38e610842fb 100644 (file)
@@ -71,7 +71,7 @@ public:
                            const map<int, bufferlist> &chunks,
                            map<int, bufferlist> *decoded);
 
-  void init(ErasureCodeProfile &profile);
+  virtual int init(ErasureCodeProfile &profile, ostream *ss);
 
   virtual void jerasure_encode(char **data,
                                char **coding,
index d461c69ac5190afe5957f3457cddd3b71f85f1e3..163b0c247cb98790264fbcb086f671bb00c10341 100644 (file)
@@ -32,7 +32,8 @@ static ostream& _prefix(std::ostream* _dout)
 class ErasureCodePluginJerasure : public ErasureCodePlugin {
 public:
   virtual int factory(ErasureCodeProfile &profile,
-                     ErasureCodeInterfaceRef *erasure_code) {
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss) {
     ErasureCodeJerasure *interface;
     std::string t;
     if (profile.find("technique") != profile.end())
@@ -59,7 +60,12 @@ public:
           << dendl;
       return -ENOENT;
     }
-    interface->init(profile);
+    dout(20) << __func__ << ": " << profile << dendl;
+    int r = interface->init(profile, ss);
+    if (r) {
+      delete interface;
+      return r;
+    }
     *erasure_code = ErasureCodeInterfaceRef(interface);
     return 0;
   }
index c072161fe7cad709a2fb0e422e3feb92eb0681b3..0ac3132ae3327b0a5136581d1eead525aa9d4a2d 100644 (file)
@@ -55,9 +55,9 @@ static string get_variant() {
 class ErasureCodePluginSelectJerasure : public ErasureCodePlugin {
 public:
   virtual int factory(ErasureCodeProfile &profile,
-                     ErasureCodeInterfaceRef *erasure_code) {
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss) {
     ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-    stringstream ss;
     int ret;
     string name = "jerasure";
     if (profile.count("jerasure-name"))
@@ -72,8 +72,6 @@ public:
       dout(10) << variant << " plugin" << dendl;
       ret = instance.factory(name + "_" + variant, profile, erasure_code, ss);
     }
-    if (ret)
-      derr << ss.str() << dendl;
     return ret;
   }
 };
@@ -87,7 +85,7 @@ int __erasure_code_init(char *plugin_name, char *directory)
   ErasureCodePlugin *plugin;
   stringstream ss;
   int r = instance.load(plugin_name + string("_") + variant,
-                       directory, &plugin, ss);
+                       directory, &plugin, &ss);
   if (r) {
     derr << ss.str() << dendl;
     return r;
index 25d4878c7786362c6e6c09779a2741445b730e2b..aafc304048482ba654a357f4369f8bf27d632d99 100644 (file)
@@ -197,7 +197,7 @@ int ErasureCodeLrc::layers_parse(string description_string,
   return 0;
 }
 
-int ErasureCodeLrc::layers_init()
+int ErasureCodeLrc::layers_init(ostream *ss)
 {
   ErasureCodePluginRegistry &registry = ErasureCodePluginRegistry::instance();
   for (unsigned int i = 0; i < layers.size(); i++) {
@@ -217,7 +217,6 @@ int ErasureCodeLrc::layers_init()
     layer.chunks = layer.data;
     layer.chunks.insert(layer.chunks.end(),
                        layer.coding.begin(), layer.coding.end());
-    stringstream ss;
     if (layer.profile.find("k") == layer.profile.end())
       layer.profile["k"] = stringify(layer.data.size());
     if (layer.profile.find("m") == layer.profile.end())
@@ -232,10 +231,8 @@ int ErasureCodeLrc::layers_init()
                               layer.profile,
                               &layer.erasure_code,
                               ss);
-    if (err) {
-      derr << ss.str() << dendl;
+    if (err)
       return err;
-    }
   }
   return 0;
 }
@@ -505,7 +502,7 @@ int ErasureCodeLrc::init(ErasureCodeProfile &profile,
   if (r)
     return r;
 
-  r = layers_init();
+  r = layers_init(ss);
   if (r)
     return r;
 
index cd4351b77fe7be8ccecf2248d88dd9dd957cdeab..221c1676fd69b88ff267dfebc84cdf1012c33d2d 100644 (file)
@@ -126,7 +126,7 @@ public:
   int layers_parse(string description_string,
                   json_spirit::mArray description,
                   ostream *ss);
-  int layers_init();
+  int layers_init(ostream *ss);
   int layers_sanity_checks(string description_string,
                           ostream *ss) const;
 };
index 8c6d5e779f5fb3c9eaf87b8adc5aa7aa2afc4c52..0a52c9cedbfecacdc3a1fa28bae044ed3cf78109 100644 (file)
 #undef dout_prefix
 #define dout_prefix _prefix(_dout)
 
-static ostream& _prefix(std::ostream* _dout)
-{
-  return *_dout << "ErasureCodePluginLrc: ";
-}
-
 class ErasureCodePluginLrc : public ErasureCodePlugin {
 public:
   virtual int factory(ErasureCodeProfile &profile,
-                     ErasureCodeInterfaceRef *erasure_code) {
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss) {
     ErasureCodeLrc *interface;
     interface = new ErasureCodeLrc();
-    stringstream ss;
     assert(profile.count("directory") != 0);
-    int r = interface->init(profile, &ss);
+    int r = interface->init(profile, ss);
     if (r) {
-      derr << ss.str() << dendl;
       delete interface;
       return r;
     }
index 407c3241cc4772c7952420742f046a63265ebf1a..d581e5d73c4de756c4ba63bca120231c1d71d485 100644 (file)
@@ -38,7 +38,8 @@ public:
   ErasureCodeShecTableCache tcache;
 
   virtual int factory(ErasureCodeProfile &profile,
-                     ErasureCodeInterfaceRef *erasure_code) {
+                     ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss) {
     ErasureCodeShec *interface;
     std::string t = "multiple";
 
@@ -57,7 +58,7 @@ public:
           << dendl;
       return -ENOENT;
     }
-    int r = interface->init(profile);
+    int r = interface->init(profile, ss);
     if (r) {
       delete interface;
       return r;
index 17cd9135a1274d1750ef56a1597adab769a637ce..4283ce0f705fb510c4e6aa30e9b65c7e2764faa3 100644 (file)
@@ -54,8 +54,10 @@ int ErasureCodeShec::create_ruleset(const string &name,
   }
 }
 
-int ErasureCodeShec::init(ErasureCodeProfile &profile)
+int ErasureCodeShec::init(ErasureCodeProfile &profile,
+                         ostream *ss)
 {
+  int err = 0;
   map<string,string>::const_iterator parameter;
   parameter = profile.find("ruleset-root");
   if (parameter != profile.end())
@@ -63,12 +65,11 @@ int ErasureCodeShec::init(ErasureCodeProfile &profile)
   parameter = profile.find("ruleset-failure-domain");
   if (parameter != profile.end())
     ruleset_failure_domain = parameter->second;
-  int err = parse(profile);
-  if (err) {
+  err |= parse(profile);
+  if (err)
     return err;
-  }
   prepare();
-  return 0;
+  return err;
 }
 
 unsigned int ErasureCodeShec::get_chunk_size(unsigned int object_size) const
index 1cc612cede5887abe20d554064297007c3ea6078..680fd255c4803bf831d0866028f8f71ae4d5d7ec 100644 (file)
@@ -102,7 +102,7 @@ public:
                            const map<int, bufferlist> &chunks,
                            map<int, bufferlist> *decoded);
 
-  int init(ErasureCodeProfile &profile);
+  virtual int init(ErasureCodeProfile &profile, ostream *ss);
   virtual void shec_encode(char **data,
                           char **coding,
                           int blocksize) = 0;
index cb77fa55be2e62bafff60b1880f524e7b20f4639..c3be47e75baa97b95ea5855dac8ec193f2a18ed0 100644 (file)
@@ -3900,12 +3900,12 @@ int OSDMonitor::prepare_new_pool(MPoolOp *m)
     return prepare_new_pool(m->name, m->auid, m->crush_rule, ruleset_name,
                            0, 0,
                             erasure_code_profile,
-                           pg_pool_t::TYPE_REPLICATED, 0, ss);
+                           pg_pool_t::TYPE_REPLICATED, 0, &ss);
   else
     return prepare_new_pool(m->name, session->auid, m->crush_rule, ruleset_name,
                            0, 0,
                             erasure_code_profile,
-                           pg_pool_t::TYPE_REPLICATED, 0, ss);
+                           pg_pool_t::TYPE_REPLICATED, 0, &ss);
 }
 
 int OSDMonitor::crush_rename_bucket(const string& srcname,
@@ -3943,7 +3943,7 @@ int OSDMonitor::crush_rename_bucket(const string& srcname,
 int OSDMonitor::crush_ruleset_create_erasure(const string &name,
                                             const string &profile,
                                             int *ruleset,
-                                            stringstream &ss)
+                                            ostream *ss)
 {
   int ruleid = osdmap.crush->get_rule_id(name);
   if (ruleid != -ENOENT) {
@@ -3962,11 +3962,11 @@ int OSDMonitor::crush_ruleset_create_erasure(const string &name,
     ErasureCodeInterfaceRef erasure_code;
     int err = get_erasure_code(profile, &erasure_code, ss);
     if (err) {
-      ss << "failed to load plugin using profile " << profile << std::endl;
+      *ss << "failed to load plugin using profile " << profile << std::endl;
       return err;
     }
 
-    err = erasure_code->create_ruleset(name, newcrush, &ss);
+    err = erasure_code->create_ruleset(name, newcrush, ss);
     erasure_code.reset();
     if (err < 0)
       return err;
@@ -3979,7 +3979,7 @@ int OSDMonitor::crush_ruleset_create_erasure(const string &name,
 
 int OSDMonitor::get_erasure_code(const string &erasure_code_profile,
                                 ErasureCodeInterfaceRef *erasure_code,
-                                stringstream &ss) const
+                                ostream *ss) const
 {
   if (pending_inc.has_erasure_code_profile(erasure_code_profile))
     return -EAGAIN;
@@ -3988,7 +3988,7 @@ int OSDMonitor::get_erasure_code(const string &erasure_code_profile,
   ErasureCodeProfile::const_iterator plugin =
     profile.find("plugin");
   if (plugin == profile.end()) {
-    ss << "cannot determine the erasure code plugin"
+    *ss << "cannot determine the erasure code plugin"
        << " because there is no 'plugin' entry in the erasure_code_profile "
        << profile << std::endl;
     return -EINVAL;
@@ -4065,29 +4065,29 @@ bool OSDMonitor::validate_crush_against_features(const CrushWrapper *newcrush,
 
 bool OSDMonitor::erasure_code_profile_in_use(const map<int64_t, pg_pool_t> &pools,
                                             const string &profile,
-                                            ostream &ss)
+                                            ostream *ss)
 {
   bool found = false;
   for (map<int64_t, pg_pool_t>::const_iterator p = pools.begin();
        p != pools.end();
        ++p) {
     if (p->second.erasure_code_profile == profile) {
-      ss << osdmap.pool_name[p->first] << " ";
+      *ss << osdmap.pool_name[p->first] << " ";
       found = true;
     }
   }
   if (found) {
-    ss << "pool(s) are using the erasure code profile '" << profile << "'";
+    *ss << "pool(s) are using the erasure code profile '" << profile << "'";
   }
   return found;
 }
 
 int OSDMonitor::parse_erasure_code_profile(const vector<string> &erasure_code_profile,
                                           map<string,string> *erasure_code_profile_map,
-                                          stringstream &ss)
+                                          ostream *ss)
 {
   int r = get_json_str_map(g_conf->osd_pool_default_erasure_code_profile,
-                          ss,
+                          *ss,
                           erasure_code_profile_map);
   if (r)
     return r;
@@ -4123,7 +4123,7 @@ int OSDMonitor::parse_erasure_code_profile(const vector<string> &erasure_code_pr
 int OSDMonitor::prepare_pool_size(const unsigned pool_type,
                                  const string &erasure_code_profile,
                                  unsigned *size, unsigned *min_size,
-                                 stringstream &ss)
+                                 ostream *ss)
 {
   int err = 0;
   switch (pool_type) {
@@ -4142,7 +4142,7 @@ int OSDMonitor::prepare_pool_size(const unsigned pool_type,
     }
     break;
   default:
-    ss << "prepare_pool_size: " << pool_type << " is not a known pool type";
+    *ss << "prepare_pool_size: " << pool_type << " is not a known pool type";
     err = -EINVAL;
     break;
   }
@@ -4152,7 +4152,7 @@ int OSDMonitor::prepare_pool_size(const unsigned pool_type,
 int OSDMonitor::prepare_pool_stripe_width(const unsigned pool_type,
                                          const string &erasure_code_profile,
                                          uint32_t *stripe_width,
-                                         stringstream &ss)
+                                         ostream *ss)
 {
   int err = 0;
   switch (pool_type) {
@@ -4170,7 +4170,7 @@ int OSDMonitor::prepare_pool_stripe_width(const unsigned pool_type,
     }
     break;
   default:
-    ss << "prepare_pool_stripe_width: "
+    *ss << "prepare_pool_stripe_width: "
        << pool_type << " is not a known pool type";
     err = -EINVAL;
     break;
@@ -4182,7 +4182,7 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type,
                                           const string &erasure_code_profile,
                                           const string &ruleset_name,
                                           int *crush_ruleset,
-                                          stringstream &ss)
+                                          ostream *ss)
 {
   if (*crush_ruleset < 0) {
     switch (pool_type) {
@@ -4193,7 +4193,7 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type,
          *crush_ruleset = osdmap.crush->get_osd_pool_default_crush_replicated_ruleset(g_ceph_context);
          if (*crush_ruleset < 0) {
            // Errors may happen e.g. if no valid ruleset is available
-           ss << "No suitable CRUSH ruleset exists";
+           *ss << "No suitable CRUSH ruleset exists";
            return *crush_ruleset;
          }
        } else {
@@ -4222,14 +4222,14 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type,
       }
       break;
     default:
-      ss << "prepare_pool_crush_ruleset: " << pool_type
+      *ss << "prepare_pool_crush_ruleset: " << pool_type
         << " is not a known pool type";
       return -EINVAL;
       break;
     }
   } else {
     if (!osdmap.crush->ruleset_exists(*crush_ruleset)) {
-      ss << "CRUSH ruleset " << *crush_ruleset << " not found";
+      *ss << "CRUSH ruleset " << *crush_ruleset << " not found";
       return -ENOENT;
     }
   }
@@ -4239,7 +4239,7 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type,
 
 int OSDMonitor::get_crush_ruleset(const string &ruleset_name,
                                  int *crush_ruleset,
-                                 stringstream &ss)
+                                 ostream *ss)
 {
   int ret;
   ret = osdmap.crush->get_rule_id(ruleset_name);
@@ -4258,7 +4258,7 @@ int OSDMonitor::get_crush_ruleset(const string &ruleset_name,
       return -EAGAIN;
     } else {
       //Cannot find it , return error
-      ss << "specified ruleset " << ruleset_name << " doesn't exist";
+      *ss << "specified ruleset " << ruleset_name << " doesn't exist";
       return ret;
     }
   }
@@ -4286,7 +4286,7 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid,
                                 const string &erasure_code_profile,
                                  const unsigned pool_type,
                                  const uint64_t expected_num_objects,
-                                stringstream &ss)
+                                ostream *ss)
 {
   if (name.length() == 0)
     return -EINVAL;
@@ -4510,7 +4510,7 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
        ErasureCodeInterfaceRef erasure_code;
        int k;
        stringstream tmp;
-       int err = get_erasure_code(p.erasure_code_profile, &erasure_code, tmp);
+       int err = get_erasure_code(p.erasure_code_profile, &erasure_code, &tmp);
        if (err == 0) {
         k = erasure_code->get_data_chunk_count();
        } else {
@@ -5399,10 +5399,10 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
     string name;
     cmd_getval(g_ceph_context, cmdmap, "name", name);
 
-    if (erasure_code_profile_in_use(pending_inc.new_pools, name, ss))
+    if (erasure_code_profile_in_use(pending_inc.new_pools, name, &ss))
       goto wait;
 
-    if (erasure_code_profile_in_use(osdmap.pools, name, ss)) {
+    if (erasure_code_profile_in_use(osdmap.pools, name, &ss)) {
       err = -EBUSY;
       goto reply;
     }
@@ -5439,7 +5439,7 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
       force = false;
     }
     map<string,string> profile_map;
-    err = parse_erasure_code_profile(profile, &profile_map, ss);
+    err = parse_erasure_code_profile(profile, &profile_map, &ss);
     if (err)
       goto reply;
     if (profile_map.find("plugin") == profile_map.end()) {
@@ -5523,7 +5523,7 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
     }
 
     int ruleset;
-    err = crush_ruleset_create_erasure(name, profile, &ruleset, ss);
+    err = crush_ruleset_create_erasure(name, profile, &ruleset, &ss);
     if (err < 0) {
       switch(err) {
       case -EEXIST: // return immediately
@@ -6297,7 +6297,7 @@ done:
 
     if (!implicit_ruleset_creation && ruleset_name != "") {
       int ruleset;
-      err = get_crush_ruleset(ruleset_name, &ruleset, ss);
+      err = get_crush_ruleset(ruleset_name, &ruleset, &ss);
       if (err == -EAGAIN) {
        wait_for_finished_proposal(new C_RetryMessage(this, m));
        return true;
@@ -6319,7 +6319,7 @@ done:
                           pg_num, pgp_num,
                           erasure_code_profile, pool_type,
                            (uint64_t)expected_num_objects,
-                          ss);
+                          &ss);
     if (err < 0) {
       switch(err) {
       case -EEXIST:
index 41cd805a7e2d42590e6cc1258395953dfa622cc4..bd533c9eb8ecf68968063aec2d14d67b9b613654 100644 (file)
@@ -280,32 +280,32 @@ private:
   int crush_ruleset_create_erasure(const string &name,
                                   const string &profile,
                                   int *ruleset,
-                                  stringstream &ss);
+                                  ostream *ss);
   int get_crush_ruleset(const string &ruleset_name,
                        int *crush_ruleset,
-                       stringstream &ss);
+                       ostream *ss);
   int get_erasure_code(const string &erasure_code_profile,
                       ErasureCodeInterfaceRef *erasure_code,
-                      stringstream &ss) const;
+                      ostream *ss) const;
   int prepare_pool_crush_ruleset(const unsigned pool_type,
                                 const string &erasure_code_profile,
                                 const string &ruleset_name,
                                 int *crush_ruleset,
-                                stringstream &ss);
+                                ostream *ss);
   bool erasure_code_profile_in_use(const map<int64_t, pg_pool_t> &pools,
                                   const string &profile,
-                                  ostream &ss);
+                                  ostream *ss);
   int parse_erasure_code_profile(const vector<string> &erasure_code_profile,
                                 map<string,string> *erasure_code_profile_map,
-                                stringstream &ss);
+                                ostream *ss);
   int prepare_pool_size(const unsigned pool_type,
                        const string &erasure_code_profile,
                        unsigned *size, unsigned *min_size,
-                       stringstream &ss);
+                       ostream *ss);
   int prepare_pool_stripe_width(const unsigned pool_type,
                                const string &erasure_code_profile,
                                unsigned *stripe_width,
-                               stringstream &ss);
+                               ostream *ss);
   int prepare_new_pool(string& name, uint64_t auid,
                       int crush_ruleset,
                       const string &crush_ruleset_name,
@@ -313,7 +313,7 @@ private:
                       const string &erasure_code_profile,
                        const unsigned pool_type,
                        const uint64_t expected_num_objects,
-                      stringstream &ss);
+                      ostream *ss);
   int prepare_new_pool(MPoolOp *m);
 
   void update_pool_flags(int64_t pool_id, uint64_t flags);
index 5de764ff4e17edb936d2d7b4073cd915f2e22eb5..dd25f7209a20122fd17b593693175e1cf59b3a90 100644 (file)
@@ -299,7 +299,7 @@ PGBackend *PGBackend::build_pg_backend(
       profile.find("plugin")->second,
       profile,
       &ec_impl,
-      ss);
+      &ss);
     assert(ec_impl);
     return new ECBackend(
       l,
index dce35d18e557f1a218e91b561a572933dad93714..c45d7f78d9a5bd05c601424d37f80e8598be0d11 100644 (file)
@@ -39,6 +39,10 @@ class ErasureCodeExample : public ErasureCode {
 public:
   virtual ~ErasureCodeExample() {}
 
+  virtual int init(ErasureCodeProfile &profile, ostream *ss) {
+    return 0;
+  }
+
   virtual int create_ruleset(const string &name,
                             CrushWrapper &crush,
                             ostream *ss) const {
index c3fb2c99b8df6fd3a3e91bf0d2904573b5e1f0d0..96e4c462b21348f3a1d830471be89d5c5bb87d8b 100644 (file)
@@ -24,7 +24,8 @@
 class ErasureCodePluginExample : public ErasureCodePlugin {
 public:
   virtual int factory(ErasureCodeProfile &profile,
-                      ErasureCodeInterfaceRef *erasure_code)
+                      ErasureCodeInterfaceRef *erasure_code,
+                     ostream *ss)
   {
     *erasure_code = ErasureCodeInterfaceRef(new ErasureCodeExample());
     return 0;
index 2c972610fc7a82d7b57736f9ce0bca70899a36ec..d6f98a92a1ff67dbc4821851863e9d2db6bbdb31 100644 (file)
@@ -33,6 +33,10 @@ public:
     k(_k), m(_m), chunk_size(_chunk_size) {}
   virtual ~ErasureCodeTest() {}
 
+  virtual int init(ErasureCodeProfile &profile, ostream *ss) {
+    return 0;
+  }
+
   virtual unsigned int get_chunk_count() const { return k + m; }
   virtual unsigned int get_data_chunk_count() const { return k; }
   virtual unsigned int get_chunk_size(unsigned int object_size) const {
index 816ef58f4452ffe3ea5fb2431702ae12438433b1..ce2b056da4689d6d25cb9c2e6f024581586eeed9 100644 (file)
@@ -53,7 +53,7 @@ void IsaErasureCodeTest::encode_decode(unsigned object_size)
   ErasureCodeProfile profile;
   profile["k"] = "2";
   profile["m"] = "2";
-  Isa.init(profile);
+  Isa.init(profile, &cerr);
 
   string payload(object_size, 'X');
   bufferlist in;
@@ -193,7 +193,7 @@ TEST_F(IsaErasureCodeTest, minimum_to_decode)
   ErasureCodeProfile profile;
   profile["k"] = "2";
   profile["m"] = "2";
-  Isa.init(profile);
+  Isa.init(profile, &cerr);
 
   //
   // If trying to read nothing, the minimum is empty.
@@ -290,7 +290,7 @@ TEST_F(IsaErasureCodeTest, chunk_size)
     ErasureCodeProfile profile;
     profile["k"] = "2";
     profile["m"] = "1";
-    Isa.init(profile);
+    Isa.init(profile, &cerr);
     int k = 2;
 
     ASSERT_EQ(EC_ISA_ADDRESS_ALIGNMENT, Isa.get_chunk_size(1));
@@ -302,7 +302,7 @@ TEST_F(IsaErasureCodeTest, chunk_size)
     ErasureCodeProfile profile;
     profile["k"] = "3";
     profile["m"] = "1";
-    Isa.init(profile);
+    Isa.init(profile, &cerr);
     int k = 3;
 
     ASSERT_EQ(EC_ISA_ADDRESS_ALIGNMENT, Isa.get_chunk_size(1));
@@ -323,7 +323,7 @@ TEST_F(IsaErasureCodeTest, encode)
   ErasureCodeProfile profile;
   profile["k"] = "2";
   profile["m"] = "2";
-  Isa.init(profile);
+  Isa.init(profile, &cerr);
 
   unsigned aligned_object_size = Isa.get_alignment() * 2;
   {
@@ -394,7 +394,7 @@ TEST_F(IsaErasureCodeTest, isa_vandermonde_exhaustive)
   ErasureCodeProfile profile;
   profile["k"] = "12";
   profile["m"] = "4";
-  Isa.init(profile);
+  Isa.init(profile, &cerr);
 
   int k = 12;
   int m = 4;
@@ -521,7 +521,7 @@ TEST_F(IsaErasureCodeTest, isa_cauchy_exhaustive)
   profile["m"] = "4";
   profile["technique"] = "cauchy";
 
-  Isa.init(profile);
+  Isa.init(profile, &cerr);
 
   int k = 12;
   int m = 4;
@@ -648,7 +648,7 @@ TEST_F(IsaErasureCodeTest, isa_cauchy_cache_trash)
   profile["m"] = "4";
   profile["technique"] = "cauchy";
 
-  Isa.init(profile);
+  Isa.init(profile, &cerr);
 
   int k = 16;
   int m = 4;
@@ -774,7 +774,7 @@ TEST_F(IsaErasureCodeTest, isa_xor_codec)
   ErasureCodeProfile profile;
   profile["k"] = "4";
   profile["m"] = "1";
-  Isa.init(profile);
+  Isa.init(profile, &cerr);
 
   int k = 4;
   int m = 1;
@@ -899,7 +899,7 @@ TEST_F(IsaErasureCodeTest, create_ruleset)
     profile["k"] = "2";
     profile["m"] = "2";
     profile["w"] = "8";
-    isa.init(profile);
+    isa.init(profile, &cerr);
     int ruleset = isa.create_ruleset("myrule", *c, &ss);
     EXPECT_EQ(0, ruleset);
     EXPECT_EQ(-EEXIST, isa.create_ruleset("myrule", *c, &ss));
@@ -924,7 +924,7 @@ TEST_F(IsaErasureCodeTest, create_ruleset)
     profile["m"] = "2";
     profile["w"] = "8";
     profile["ruleset-root"] = "BAD";
-    isa.init(profile);
+    isa.init(profile, &cerr);
     EXPECT_EQ(-ENOENT, isa.create_ruleset("otherrule", *c, &ss));
     EXPECT_EQ("root item BAD does not exist", ss.str());
   }
@@ -936,7 +936,7 @@ TEST_F(IsaErasureCodeTest, create_ruleset)
     profile["m"] = "2";
     profile["w"] = "8";
     profile["ruleset-failure-domain"] = "WORSE";
-    isa.init(profile);
+    isa.init(profile, &cerr);
     EXPECT_EQ(-EINVAL, isa.create_ruleset("otherrule", *c, &ss));
     EXPECT_EQ("unknown type WORSE", ss.str());
   }
index 1eca4909de52b4c2ef3b4cc0ef281a7218e48a3d..4cccb5c3f3087643a31326f7a9c9ead554af205c 100644 (file)
@@ -54,7 +54,7 @@ TYPED_TEST(ErasureCodeTest, encode_decode)
     profile["packetsize"] = "8";
     profile["jerasure-per-chunk-alignment"] =
       per_chunk_alignments[per_chunk_alignment];
-    jerasure.init(profile);
+    jerasure.init(profile, &cerr);
 
 #define LARGE_ENOUGH 2048
     bufferptr in_ptr(buffer::create_page_aligned(LARGE_ENOUGH));
@@ -124,7 +124,7 @@ TYPED_TEST(ErasureCodeTest, minimum_to_decode)
   profile["m"] = "2";
   profile["w"] = "7";
   profile["packetsize"] = "8";
-  jerasure.init(profile);
+  jerasure.init(profile, &cerr);
 
   //
   // If trying to read nothing, the minimum is empty.
@@ -221,7 +221,7 @@ TEST(ErasureCodeTest, encode)
   profile["k"] = "2";
   profile["m"] = "2";
   profile["w"] = "8";
-  jerasure.init(profile);
+  jerasure.init(profile, &cerr);
 
   unsigned aligned_object_size = jerasure.get_alignment() * 2;
   {
@@ -300,7 +300,7 @@ TEST(ErasureCodeTest, create_ruleset)
     profile["k"] = "2";
     profile["m"] = "2";
     profile["w"] = "8";
-    jerasure.init(profile);
+    jerasure.init(profile, &cerr);
     int ruleset = jerasure.create_ruleset("myrule", *c, &ss);
     EXPECT_EQ(0, ruleset);
     EXPECT_EQ(-EEXIST, jerasure.create_ruleset("myrule", *c, &ss));
@@ -325,7 +325,7 @@ TEST(ErasureCodeTest, create_ruleset)
     profile["m"] = "2";
     profile["w"] = "8";
     profile["ruleset-root"] = "BAD";
-    jerasure.init(profile);
+    jerasure.init(profile, &cerr);
     EXPECT_EQ(-ENOENT, jerasure.create_ruleset("otherrule", *c, &ss));
     EXPECT_EQ("root item BAD does not exist", ss.str());
   }
@@ -337,7 +337,7 @@ TEST(ErasureCodeTest, create_ruleset)
     profile["m"] = "2";
     profile["w"] = "8";
     profile["ruleset-failure-domain"] = "WORSE";
-    jerasure.init(profile);
+    jerasure.init(profile, &cerr);
     EXPECT_EQ(-EINVAL, jerasure.create_ruleset("otherrule", *c, &ss));
     EXPECT_EQ("unknown type WORSE", ss.str());
   }
index c03195950e82002548d08a96aa3ba8accd082a37..2d44a1e952e77cc7ff9aa4762497bc755a55dcea 100644 (file)
@@ -411,7 +411,7 @@ TEST(ErasureCodeLrc, layers_init)
     json_spirit::mArray description;
     EXPECT_EQ(0, lrc.layers_description(profile, &description, &cerr));
     EXPECT_EQ(0, lrc.layers_parse(description_string, description, &cerr));
-    EXPECT_EQ(0, lrc.layers_init());
+    EXPECT_EQ(0, lrc.layers_init(&cerr));
     EXPECT_EQ("5", lrc.layers.front().profile["k"]);
     EXPECT_EQ("2", lrc.layers.front().profile["m"]);
     EXPECT_EQ("jerasure", lrc.layers.front().profile["plugin"]);
index 314f44f0c93e76a6c626598c729f66867b585c5d..e8c594fc8e6f712675c4f0fdb2d04b3d0674ee1d 100644 (file)
@@ -34,8 +34,7 @@ protected:
       profile["directory"] = ".libs";
       ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
       ErasureCodeInterfaceRef erasure_code;
-      stringstream ss;
-      instance.factory("hangs", profile, &erasure_code, ss);
+      instance.factory("hangs", profile, &erasure_code, &cerr);
       return NULL;
     }
   };
@@ -77,31 +76,30 @@ TEST_F(ErasureCodePluginRegistryTest, all)
   profile["directory"] = directory;
   ErasureCodeInterfaceRef erasure_code;
   ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
-  stringstream ss;
   EXPECT_FALSE(erasure_code);
-  EXPECT_EQ(-EIO, instance.factory("invalid", profile, &erasure_code, ss));
+  EXPECT_EQ(-EIO, instance.factory("invalid", profile, &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-EXDEV, instance.factory("missing_version", profile,
-                                    &erasure_code, ss));
+                                    &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-ENOENT, instance.factory("missing_entry_point", profile,
-                                     &erasure_code, ss));
+                                     &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-ESRCH, instance.factory("fail_to_initialize", profile,
-                                    &erasure_code, ss));
+                                    &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
   EXPECT_EQ(-EBADF, instance.factory("fail_to_register", profile,
-                                    &erasure_code, ss));
+                                    &erasure_code, &cerr));
   EXPECT_FALSE(erasure_code);
-  EXPECT_EQ(0, instance.factory("example", profile, &erasure_code, ss));
+  EXPECT_EQ(0, instance.factory("example", profile, &erasure_code, &cerr));
   EXPECT_TRUE(erasure_code);
   ErasureCodePlugin *plugin = 0;
   {
     Mutex::Locker l(instance.lock);
-    EXPECT_EQ(-EEXIST, instance.load("example", directory, &plugin, ss));
+    EXPECT_EQ(-EEXIST, instance.load("example", directory, &plugin, &cerr));
     EXPECT_EQ(-ENOENT, instance.remove("does not exist"));
     EXPECT_EQ(0, instance.remove("example"));
-    EXPECT_EQ(0, instance.load("example", directory, &plugin, ss));
+    EXPECT_EQ(0, instance.load("example", directory, &plugin, &cerr));
   }
 }
 
index 59d918abc64d65ca38e871544e4bd0329045b64b..e730b40015414e0f1e63a621758cdf33e259c45c 100644 (file)
@@ -30,7 +30,7 @@ TEST(ErasureCodePlugin, factory)
     ErasureCodeInterfaceRef erasure_code;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(-EIO, instance.factory("no-isa", profile,
-                                        &erasure_code, cerr));
+                                        &erasure_code, &cerr));
     EXPECT_FALSE(erasure_code);
   }
   const char *techniques[] = {
@@ -42,7 +42,7 @@ TEST(ErasureCodePlugin, factory)
     profile["technique"] = *technique;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(0, instance.factory("isa", profile,
-                                  &erasure_code, cerr));
+                                  &erasure_code, &cerr));
     EXPECT_TRUE(erasure_code);
   }
 }
index 31b250f65297cd86d5ca34ab877b1e3c9a000296..ad456c0235f9a93d1f6a4da138e41b864b74b216 100644 (file)
@@ -34,7 +34,7 @@ TEST(ErasureCodePlugin, factory)
     ErasureCodeInterfaceRef erasure_code;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(-ENOENT, instance.factory("jerasure", profile,
-                                        &erasure_code, cerr));
+                                        &erasure_code, &cerr));
     EXPECT_FALSE(erasure_code);
   }
   const char *techniques[] = {
@@ -54,7 +54,7 @@ TEST(ErasureCodePlugin, factory)
     profile["technique"] = *technique;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(0, instance.factory("jerasure", profile,
-                                  &erasure_code, cerr));
+                                  &erasure_code, &cerr));
     EXPECT_TRUE(erasure_code);
   }
 }
@@ -92,7 +92,7 @@ TEST(ErasureCodePlugin, select)
     ErasureCodeInterfaceRef erasure_code;
     int sse4_side_effect = -444;
     EXPECT_EQ(sse4_side_effect, instance.factory("jerasure", profile,
-                                                 &erasure_code, cerr));
+                                                 &erasure_code, &cerr));
   }
   // pclmul is missing, load the SSE3 plugin
   {
@@ -107,7 +107,7 @@ TEST(ErasureCodePlugin, select)
     ErasureCodeInterfaceRef erasure_code;
     int sse3_side_effect = -333;
     EXPECT_EQ(sse3_side_effect, instance.factory("jerasure", profile,
-                                                 &erasure_code, cerr));
+                                                 &erasure_code, &cerr));
   }
   // pclmul and sse3 are missing, load the generic plugin
   {
@@ -122,7 +122,7 @@ TEST(ErasureCodePlugin, select)
     ErasureCodeInterfaceRef erasure_code;
     int generic_side_effect = -111;
     EXPECT_EQ(generic_side_effect, instance.factory("jerasure", profile,
-                                                   &erasure_code, cerr));
+                                                   &erasure_code, &cerr));
   }
   // neon is set, load the neon plugin
   {
@@ -137,7 +137,7 @@ TEST(ErasureCodePlugin, select)
     ErasureCodeInterfaceRef erasure_code;
     int generic_side_effect = -555;
     EXPECT_EQ(generic_side_effect, instance.factory("jerasure", profile,
-                                                   &erasure_code, cerr));
+                                                   &erasure_code, &cerr));
   }
 
 
@@ -200,7 +200,7 @@ TEST(ErasureCodePlugin, sse)
     ErasureCodeInterfaceRef erasure_code;
     EXPECT_FALSE(erasure_code);
     EXPECT_EQ(0, instance.factory("jerasure_" + *sse_variant, profile,
-                                  &erasure_code, cerr));
+                                  &erasure_code, &cerr));
     EXPECT_TRUE(erasure_code);
 
     //
index 165e21511c54205844b873c5faa7cfbaf05f6e31..fea576c546082ddbb4232d28c26f3e95d27d93ad 100644 (file)
@@ -33,7 +33,7 @@ TEST(ErasureCodePlugin, factory)
   profile["layers"] = "[ [ \"DDc\", \"\" ] ]";
   ErasureCodeInterfaceRef erasure_code;
   EXPECT_FALSE(erasure_code);
-  EXPECT_EQ(0, instance.factory("lrc", profile, &erasure_code, cerr));
+  EXPECT_EQ(0, instance.factory("lrc", profile, &erasure_code, &cerr));
   EXPECT_TRUE(erasure_code);
 }
 
index 472f001067f98a7e46c80e458e6410d3d6cf5b2d..f0d63cb5112f5ef265b159bb4cfd5dfdfc086338 100644 (file)
@@ -56,7 +56,7 @@ TEST(ErasureCodeShec, init_1)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(6, shec->k);
   EXPECT_EQ(4, shec->m);
@@ -89,7 +89,7 @@ TEST(ErasureCodeShec, init_2)
   (*profile)["c"] = "3";
   (*profile)["w"] = "8";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   //check profile
   EXPECT_EQ(6, shec->k);
@@ -122,7 +122,7 @@ TEST(ErasureCodeShec, init_3)
   (*profile)["c"] = "3";
   (*profile)["w"] = "16";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   //check profile
   EXPECT_EQ(6, shec->k);
@@ -155,7 +155,7 @@ TEST(ErasureCodeShec, init_4)
   (*profile)["c"] = "3";
   (*profile)["w"] = "32";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   //check profile
   EXPECT_EQ(6, shec->k);
@@ -186,7 +186,7 @@ TEST(ErasureCodeShec, init_5)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -209,7 +209,7 @@ TEST(ErasureCodeShec, init_6)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -232,7 +232,7 @@ TEST(ErasureCodeShec, init_7)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -256,7 +256,7 @@ TEST(ErasureCodeShec, init_8)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -280,7 +280,7 @@ TEST(ErasureCodeShec, init_9)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -303,7 +303,7 @@ TEST(ErasureCodeShec, init_10)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -326,7 +326,7 @@ TEST(ErasureCodeShec, init_11)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -349,7 +349,7 @@ TEST(ErasureCodeShec, init_12)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -371,7 +371,7 @@ TEST(ErasureCodeShec, init_13)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -393,7 +393,7 @@ TEST(ErasureCodeShec, init_14)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -415,7 +415,7 @@ TEST(ErasureCodeShec, init_15)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -437,7 +437,7 @@ TEST(ErasureCodeShec, init_16)
   (*profile)["m"] = "-1";              //unexpected value
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -459,7 +459,7 @@ TEST(ErasureCodeShec, init_17)
   (*profile)["m"] = "0.1";             //unexpected value
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -481,7 +481,7 @@ TEST(ErasureCodeShec, init_18)
   (*profile)["m"] = "a";               //unexpected value
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -503,7 +503,7 @@ TEST(ErasureCodeShec, init_19)
   //m is not specified
   (*profile)["c"] = "3";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -525,7 +525,7 @@ TEST(ErasureCodeShec, init_20)
   (*profile)["m"] = "4";
   (*profile)["c"] = "-1";              //unexpected value
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -547,7 +547,7 @@ TEST(ErasureCodeShec, init_21)
   (*profile)["m"] = "4";
   (*profile)["c"] = "0.1";             //unexpected value
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -569,7 +569,7 @@ TEST(ErasureCodeShec, init_22)
   (*profile)["m"] = "4";
   (*profile)["c"] = "a";               //unexpected value
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -591,7 +591,7 @@ TEST(ErasureCodeShec, init_23)
   (*profile)["m"] = "4";
   //c is not specified
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -614,7 +614,7 @@ TEST(ErasureCodeShec, init_24)
   (*profile)["c"] = "3";
   (*profile)["w"] = "1";               //unexpected value
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -643,7 +643,7 @@ TEST(ErasureCodeShec, init_25)
   (*profile)["c"] = "3";
   (*profile)["w"] = "-1";              //unexpected value
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -672,7 +672,7 @@ TEST(ErasureCodeShec, init_26)
   (*profile)["c"] = "3";
   (*profile)["w"] = "0.1";             //unexpected value
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -701,7 +701,7 @@ TEST(ErasureCodeShec, init_27)
   (*profile)["c"] = "3";
   (*profile)["w"] = "a";               //unexpected value
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -729,7 +729,7 @@ TEST(ErasureCodeShec, init_28)
   (*profile)["m"] = "4";
   (*profile)["c"] = "10";      //c > m
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -751,7 +751,7 @@ TEST(ErasureCodeShec, init_29)
   //m is not specified
   //c is not specified
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -778,7 +778,7 @@ TEST(ErasureCodeShec, init_30)
   (*profile)["m"] = "8";
   (*profile)["c"] = "8";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_TRUE(shec->matrix != NULL);
   EXPECT_EQ(0, r);
@@ -804,7 +804,7 @@ TEST(ErasureCodeShec, init_31)
   (*profile)["m"] = "7";
   (*profile)["c"] = "7";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -826,7 +826,7 @@ TEST(ErasureCodeShec, init_32)
   (*profile)["m"] = "13";
   (*profile)["c"] = "13";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -848,7 +848,7 @@ TEST(ErasureCodeShec, init_33)
   (*profile)["m"] = "9";
   (*profile)["c"] = "8";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -870,7 +870,7 @@ TEST(ErasureCodeShec, init_34)
   (*profile)["m"] = "12";
   (*profile)["c"] = "12";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   EXPECT_EQ(-EINVAL, r);
 
@@ -892,8 +892,8 @@ TEST(ErasureCodeShec, init2_4)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
-  int r = shec->init(*profile);        //init executed twice
+  shec->init(*profile, &cerr);
+  int r = shec->init(*profile, &cerr); //init executed twice
 
   //check profile
   EXPECT_EQ(6, shec->k);
@@ -927,7 +927,7 @@ TEST(ErasureCodeShec, init2_5)
   (*profile)["c"] = "5";
   (*profile)["w"] = "16";
 
-  int r = shec->init(*profile);
+  int r = shec->init(*profile, &cerr);
 
   //reexecute init
   (*profile2)["plugin"] = "shec";
@@ -936,7 +936,7 @@ TEST(ErasureCodeShec, init2_5)
   (*profile2)["k"] = "6";
   (*profile2)["m"] = "4";
   (*profile2)["c"] = "3";
-  shec->init(*profile2);
+  shec->init(*profile2, &cerr);
 
   EXPECT_EQ(6, shec->k);
   EXPECT_EQ(4, shec->m);
@@ -966,7 +966,7 @@ TEST(ErasureCodeShec, minimum_to_decode_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1002,7 +1002,7 @@ TEST(ErasureCodeShec, minimum_to_decode_2)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1038,7 +1038,7 @@ TEST(ErasureCodeShec, minimum_to_decode_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1073,7 +1073,7 @@ TEST(ErasureCodeShec, minimum_to_decode_4)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1109,7 +1109,7 @@ TEST(ErasureCodeShec, minimum_to_decode_5)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1145,7 +1145,7 @@ TEST(ErasureCodeShec, minimum_to_decode_6)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1180,7 +1180,7 @@ TEST(ErasureCodeShec, minimum_to_decode_7)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1216,7 +1216,7 @@ TEST(ErasureCodeShec, minimum_to_decode_8)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1249,7 +1249,7 @@ TEST(ErasureCodeShec, minimum_to_decode_9)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1290,7 +1290,7 @@ TEST(ErasureCodeShec, minimum_to_decode2_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1326,7 +1326,7 @@ TEST(ErasureCodeShec, minimum_to_decode2_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode
   set<int> want_to_decode;
@@ -1375,7 +1375,7 @@ TEST(ErasureCodeShec, minimum_to_decode_with_cost_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode_with_cost
   set<int> want_to_decode;
@@ -1411,7 +1411,7 @@ TEST(ErasureCodeShec, minimum_to_decode_with_cost_2_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //minimum_to_decode_with_cost
   set<int> want_to_decode;
@@ -1460,7 +1460,7 @@ TEST(ErasureCodeShec, encode_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1522,7 +1522,7 @@ TEST(ErasureCodeShec, encode_2)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1579,7 +1579,7 @@ TEST(ErasureCodeShec, encode_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   bufferlist in;
   in.append("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"//length = 62
@@ -1637,7 +1637,7 @@ TEST(ErasureCodeShec, encode_4)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1697,7 +1697,7 @@ TEST(ErasureCodeShec, encode_8)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1732,7 +1732,7 @@ TEST(ErasureCodeShec, encode_9)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1771,7 +1771,7 @@ TEST(ErasureCodeShec, encode2_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1831,7 +1831,7 @@ TEST(ErasureCodeShec, encode2_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1903,7 +1903,7 @@ TEST(ErasureCodeShec, decode_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -1958,7 +1958,7 @@ TEST(ErasureCodeShec, decode_2)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2013,7 +2013,7 @@ TEST(ErasureCodeShec, decode_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2075,7 +2075,7 @@ TEST(ErasureCodeShec, decode_4)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2137,7 +2137,7 @@ TEST(ErasureCodeShec, decode_7)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2204,7 +2204,7 @@ TEST(ErasureCodeShec, decode_8)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2252,7 +2252,7 @@ TEST(ErasureCodeShec, decode_9)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2307,7 +2307,7 @@ TEST(ErasureCodeShec, decode2_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2363,7 +2363,7 @@ TEST(ErasureCodeShec, decode2_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2430,7 +2430,7 @@ TEST(ErasureCodeShec, decode2_4)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //encode
   bufferlist in;
@@ -2508,7 +2508,7 @@ TEST(ErasureCodeShec, create_ruleset_1_2)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //create_ruleset
   stringstream ss;
@@ -2566,7 +2566,7 @@ TEST(ErasureCodeShec, create_ruleset_4)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //create_ruleset
   int r = shec->create_ruleset("myrule", *crush, NULL);        //ss = NULL
@@ -2617,7 +2617,7 @@ TEST(ErasureCodeShec, create_ruleset2_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //create_ruleset
   stringstream ss;
@@ -2676,7 +2676,7 @@ TEST(ErasureCodeShec, create_ruleset2_3)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //create_ruleset
   stringstream ss;
@@ -2714,7 +2714,7 @@ TEST(ErasureCodeShec, get_chunk_count_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //get_chunk_count
   EXPECT_EQ(10u, shec->get_chunk_count());
@@ -2737,7 +2737,7 @@ TEST(ErasureCodeShec, get_data_chunk_count_1)
   (*profile)["k"] = "6";
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //get_data_chunk_count
   EXPECT_EQ(6u, shec->get_data_chunk_count());
@@ -2761,7 +2761,7 @@ TEST(ErasureCodeShec, get_chunk_size_1_2)
   (*profile)["m"] = "4";
   (*profile)["c"] = "3";
   (*profile)["w"] = "8";
-  shec->init(*profile);
+  shec->init(*profile, &cerr);
 
   //when there is no padding(192=k*w*4)
   EXPECT_EQ(32u, shec->get_chunk_size(192));
index 6a26b2f40eda0d6fafb82fec93c0e8bab6210a7d..00e59e7d6a6340b5f68084775ca4b08c30e9c9bc 100644 (file)
@@ -82,7 +82,7 @@ TEST_P(ParameterTest, parameter_all)
   (*profile)["m"] = m;
   (*profile)["c"] = c;
 
-  result = shec->init(*profile);
+  result = shec->init(*profile, &cerr);
 
   //check profile
   EXPECT_EQ(i_k, shec->k);
index 3470a6397b48cbbac05aef5428c31221168a3b74..97846f5ccdbb86dc9115541f574c0ad6490a1395 100644 (file)
@@ -147,7 +147,7 @@ void* thread1(void* pParam)
     (*profile)["m"] = param->m;
     (*profile)["c"] = param->c;
     (*profile)["w"] = param->w;
-    r = shec->init(*profile);
+    r = shec->init(*profile, &cerr);
 
     int i_k = std::atoi(param->k.c_str());
     int i_m = std::atoi(param->m.c_str());
index 4c0e22373d8f4be2887810cbeb3481634f87e14a..2a88137904023a7b2991d68ef72f76fb9285f8fc 100644 (file)
@@ -145,7 +145,7 @@ int ErasureCodeCommand::display_information() {
 
   int code = instance.factory(profile["plugin"],
                              profile,
-                             &erasure_code, cerr);
+                             &erasure_code, &cerr);
   if (code)
     return code;