| 85 | } |
| 86 | |
| 87 | int ErasureCodePluginRegistry::factory(const std::string &plugin_name, |
| 88 | const std::string &directory, |
| 89 | ErasureCodeProfile &profile, |
| 90 | ErasureCodeInterfaceRef *erasure_code, |
| 91 | ostream *ss) |
| 92 | { |
| 93 | ErasureCodePlugin *plugin; |
| 94 | { |
| 95 | std::lock_guard l{lock}; |
| 96 | plugin = get(plugin_name); |
| 97 | if (plugin == 0) { |
| 98 | loading = true; |
| 99 | int r = load(plugin_name, directory, &plugin, ss); |
| 100 | loading = false; |
| 101 | if (r != 0) |
| 102 | return r; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | int r = plugin->factory(directory, profile, erasure_code, ss); |
| 107 | if (r) |
| 108 | return r; |
| 109 | if (profile != (*erasure_code)->get_profile()) { |
| 110 | *ss << __func__ << " profile " << profile << " != get_profile() " |
| 111 | << (*erasure_code)->get_profile() << std::endl; |
| 112 | return -EINVAL; |
| 113 | } |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | static const char *an_older_version() { |
| 118 | return "an older version"; |
nothing calls this directly
no test coverage detected