]> git.proxmox.com Git - ceph.git/blob - ceph/src/erasure-code/lrc/ErasureCodePluginLrc.cc
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / erasure-code / lrc / ErasureCodePluginLrc.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) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
7 * Copyright (C) 2014 Red Hat <contact@redhat.com>
8 *
9 * Author: Loic Dachary <loic@dachary.org>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 */
17
18 #include "ceph_ver.h"
19 #include "common/debug.h"
20 #include "ErasureCodePluginLrc.h"
21 #include "ErasureCodeLrc.h"
22
23 // re-include our assert
24 #include "include/assert.h"
25
26 #define dout_subsys ceph_subsys_osd
27 #undef dout_prefix
28 #define dout_prefix _prefix(_dout)
29
30 int ErasureCodePluginLrc::factory(const std::string &directory,
31 ErasureCodeProfile &profile,
32 ErasureCodeInterfaceRef *erasure_code,
33 ostream *ss) {
34 ErasureCodeLrc *interface;
35 interface = new ErasureCodeLrc(directory);
36 int r = interface->init(profile, ss);
37 if (r) {
38 delete interface;
39 return r;
40 }
41 *erasure_code = ErasureCodeInterfaceRef(interface);
42 return 0;
43 };
44
45 #ifndef BUILDING_FOR_EMBEDDED
46
47 const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
48
49 int __erasure_code_init(char *plugin_name, char *directory)
50 {
51 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
52 return instance.add(plugin_name, new ErasureCodePluginLrc());
53 }
54
55 #endif