]> git.proxmox.com Git - ceph.git/blob - ceph/src/erasure-code/clay/ErasureCodePluginClay.cc
import 15.2.0 Octopus source
[ceph.git] / ceph / src / erasure-code / clay / ErasureCodePluginClay.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2018 Indian Institute of Science <office.ece@iisc.ac.in>
7 *
8 * Author: Myna Vajha <mynaramana@gmail.com>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 */
16
17 #include "ceph_ver.h"
18 #include "common/debug.h"
19 #include "ErasureCodePluginClay.h"
20 #include "ErasureCodeClay.h"
21
22 #define dout_subsys ceph_subsys_osd
23 #undef dout_prefix
24 #define dout_prefix _prefix(_dout)
25
26 int ErasureCodePluginClay::factory(const std::string &directory,
27 ceph::ErasureCodeProfile &profile,
28 ceph::ErasureCodeInterfaceRef *erasure_code,
29 std::ostream *ss) {
30 auto interface = std::make_unique<ErasureCodeClay>(directory);
31 if (int r = interface->init(profile, ss); r) {
32 return r;
33 }
34 *erasure_code = ceph::ErasureCodeInterfaceRef(interface.release());
35 return 0;
36 };
37
38 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
39
40 int __erasure_code_init(char *plugin_name, char *directory)
41 {
42 auto& instance = ceph::ErasureCodePluginRegistry::instance();
43 return instance.add(plugin_name, new ErasureCodePluginClay());
44 }