]> git.proxmox.com Git - ceph.git/blob - ceph/src/crypto/qat/qat_crypto_plugin.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / crypto / qat / qat_crypto_plugin.h
1 /*
2 * Ceph - scalable distributed file system
3 *
4 * Copyright (C) 2017 Intel Corporation
5 *
6 * Author: Qiaowei Ren <qiaowei.ren@intel.com>
7 * Author: Ganesh Mahalingam <ganesh.mahalingam@intel.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 */
15
16 #ifndef QAT_CRYPTO_PLUGIN_H
17 #define QAT_CRYPTO_PLUGIN_H
18
19 #include "crypto/crypto_plugin.h"
20 #include "crypto/qat/qat_crypto_accel.h"
21
22
23 class QccCryptoPlugin : public CryptoPlugin {
24 static std::mutex qat_init;
25
26 public:
27
28 explicit QccCryptoPlugin(CephContext* cct) : CryptoPlugin(cct)
29 {}
30 ~QccCryptoPlugin()
31 {}
32 virtual int factory(CryptoAccelRef *cs,
33 ostream *ss)
34 {
35 std::lock_guard<std::mutex> l(qat_init);
36 if (cryptoaccel == nullptr)
37 cryptoaccel = CryptoAccelRef(new QccCryptoAccel);
38
39 *cs = cryptoaccel;
40 return 0;
41 }
42 };
43 #endif