summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2021-08-11 05:52:02 +0200
committerKefu Chai <kchai@redhat.com>2021-08-13 06:23:36 +0200
commite31166784770f94f70701018057b1c8b4e3f1c3f (patch)
tree7562bb68baf0527bf4fec38d9abe11b06fbf2acd /src
parenttest/common: build without "using namespace std" (diff)
downloadceph-e31166784770f94f70701018057b1c8b4e3f1c3f.tar.xz
ceph-e31166784770f94f70701018057b1c8b4e3f1c3f.zip
test/erasure-code: build without "using namespace std"
* add "std::" prefix in headers * add "using" declarations in .cc files. so we don't rely on "using namespace std" in one or more included headers. Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/test/erasure-code/ErasureCodeExample.h42
-rw-r--r--src/test/erasure-code/ErasureCodePluginExample.cc2
-rw-r--r--src/test/erasure-code/TestErasureCode.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodeClay.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodeIsa.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodeJerasure.cc1
-rw-r--r--src/test/erasure-code/TestErasureCodeLrc.cc1
-rw-r--r--src/test/erasure-code/TestErasureCodePlugin.cc1
-rw-r--r--src/test/erasure-code/TestErasureCodePluginClay.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodePluginIsa.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodePluginJerasure.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodePluginLrc.cc1
-rw-r--r--src/test/erasure-code/TestErasureCodePluginShec.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodeShec.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodeShec_all.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodeShec_arguments.cc2
-rw-r--r--src/test/erasure-code/TestErasureCodeShec_thread.cc2
17 files changed, 50 insertions, 20 deletions
diff --git a/src/test/erasure-code/ErasureCodeExample.h b/src/test/erasure-code/ErasureCodeExample.h
index 1258465388a..1185b38d736 100644
--- a/src/test/erasure-code/ErasureCodeExample.h
+++ b/src/test/erasure-code/ErasureCodeExample.h
@@ -35,20 +35,22 @@
#define MINIMUM_TO_RECOVER 2u
+using namespace std;
+
class ErasureCodeExample final : public ErasureCode {
public:
~ErasureCodeExample() override {}
- int create_rule(const string &name,
+ int create_rule(const std::string &name,
CrushWrapper &crush,
ostream *ss) const override {
return crush.add_simple_rule(name, "default", "host", "",
"indep", pg_pool_t::TYPE_ERASURE, ss);
}
- int minimum_to_decode_with_cost(const set<int> &want_to_read,
- const map<int, int> &available,
- set<int> *minimum) override {
+ int minimum_to_decode_with_cost(const std::set<int> &want_to_read,
+ const std::map<int, int> &available,
+ std::set<int> *minimum) override {
//
// If one chunk is more expensive to fetch than the others,
// recover it instead. For instance, if the cost reflects the
@@ -56,7 +58,7 @@ public:
// OSD and if CPU is cheap, it could make sense to recover
// instead of fetching the chunk.
//
- map<int, int> c2c(available);
+ std::map<int, int> c2c(available);
if (c2c.size() > DATA_CHUNKS) {
if (c2c[FIRST_DATA_CHUNK] > c2c[SECOND_DATA_CHUNK] &&
c2c[FIRST_DATA_CHUNK] > c2c[CODING_CHUNK])
@@ -69,7 +71,7 @@ public:
c2c.erase(CODING_CHUNK);
}
set <int> available_chunks;
- for (map<int, int>::const_iterator i = c2c.begin();
+ for (std::map<int, int>::const_iterator i = c2c.begin();
i != c2c.end();
++i)
available_chunks.insert(i->first);
@@ -88,9 +90,9 @@ public:
return ( object_size / DATA_CHUNKS ) + 1;
}
- int encode(const set<int> &want_to_encode,
+ int encode(const std::set<int> &want_to_encode,
const bufferlist &in,
- map<int, bufferlist> *encoded) override {
+ std::map<int, bufferlist> *encoded) override {
//
// make sure all data chunks have the same length, allocating
// padding if necessary.
@@ -126,20 +128,20 @@ public:
return 0;
}
- int encode_chunks(const set<int> &want_to_encode,
- map<int, bufferlist> *encoded) override {
+ int encode_chunks(const std::set<int> &want_to_encode,
+ std::map<int, bufferlist> *encoded) override {
ceph_abort();
return 0;
}
- int _decode(const set<int> &want_to_read,
- const map<int, bufferlist> &chunks,
- map<int, bufferlist> *decoded) {
+ int _decode(const std::set<int> &want_to_read,
+ const std::map<int, bufferlist> &chunks,
+ std::map<int, bufferlist> *decoded) {
//
// All chunks have the same size
//
unsigned chunk_length = (*chunks.begin()).second.length();
- for (set<int>::iterator i = want_to_read.begin();
+ for (std::set<int>::iterator i = want_to_read.begin();
i != want_to_read.end();
++i) {
if (chunks.find(*i) != chunks.end()) {
@@ -159,7 +161,7 @@ public:
// No matter what the missing chunk is, XOR of the other
// two recovers it.
//
- map<int, bufferlist>::const_iterator k = chunks.begin();
+ std::map<int, bufferlist>::const_iterator k = chunks.begin();
const char *a = k->second.front().c_str();
++k;
const char *b = k->second.front().c_str();
@@ -178,15 +180,15 @@ public:
return 0;
}
- int decode_chunks(const set<int> &want_to_read,
- const map<int, bufferlist> &chunks,
- map<int, bufferlist> *decoded) override {
+ int decode_chunks(const std::set<int> &want_to_read,
+ const std::map<int, bufferlist> &chunks,
+ std::map<int, bufferlist> *decoded) override {
ceph_abort();
return 0;
}
- const vector<int> &get_chunk_mapping() const override {
- static vector<int> mapping;
+ const std::vector<int> &get_chunk_mapping() const override {
+ static std::vector<int> mapping;
return mapping;
}
diff --git a/src/test/erasure-code/ErasureCodePluginExample.cc b/src/test/erasure-code/ErasureCodePluginExample.cc
index de105953a47..697b77d94f5 100644
--- a/src/test/erasure-code/ErasureCodePluginExample.cc
+++ b/src/test/erasure-code/ErasureCodePluginExample.cc
@@ -21,6 +21,8 @@
#include "erasure-code/ErasureCodePlugin.h"
#include "ErasureCodeExample.h"
+using namespace std;
+
class ErasureCodePluginExample : public ErasureCodePlugin {
public:
int factory(const std::string &directory,
diff --git a/src/test/erasure-code/TestErasureCode.cc b/src/test/erasure-code/TestErasureCode.cc
index 98d5bb2edf9..05b95ded402 100644
--- a/src/test/erasure-code/TestErasureCode.cc
+++ b/src/test/erasure-code/TestErasureCode.cc
@@ -22,6 +22,8 @@
#include "common/config.h"
#include "gtest/gtest.h"
+using namespace std;
+
class ErasureCodeTest : public ErasureCode {
public:
map<int, bufferlist> encode_chunks_encoded;
diff --git a/src/test/erasure-code/TestErasureCodeClay.cc b/src/test/erasure-code/TestErasureCodeClay.cc
index 3d7abddf621..cb474094894 100644
--- a/src/test/erasure-code/TestErasureCodeClay.cc
+++ b/src/test/erasure-code/TestErasureCodeClay.cc
@@ -24,6 +24,8 @@
#include "common/config_proxy.h"
#include "gtest/gtest.h"
+using namespace std;
+
TEST(ErasureCodeClay, sanity_check_k)
{
ErasureCodeClay clay(g_conf().get_val<std::string>("erasure_code_dir"));
diff --git a/src/test/erasure-code/TestErasureCodeIsa.cc b/src/test/erasure-code/TestErasureCodeIsa.cc
index 9a9476c95d7..bbd4441fc72 100644
--- a/src/test/erasure-code/TestErasureCodeIsa.cc
+++ b/src/test/erasure-code/TestErasureCodeIsa.cc
@@ -26,6 +26,8 @@
#include "common/config.h"
#include "gtest/gtest.h"
+using namespace std;
+
ErasureCodeIsaTableCache tcache;
class IsaErasureCodeTest : public ::testing::Test {
diff --git a/src/test/erasure-code/TestErasureCodeJerasure.cc b/src/test/erasure-code/TestErasureCodeJerasure.cc
index 03c233fe8fd..835f3c7b6c8 100644
--- a/src/test/erasure-code/TestErasureCodeJerasure.cc
+++ b/src/test/erasure-code/TestErasureCodeJerasure.cc
@@ -25,6 +25,7 @@
#include "common/config.h"
#include "gtest/gtest.h"
+using namespace std;
template <typename T>
class ErasureCodeTest : public ::testing::Test {
diff --git a/src/test/erasure-code/TestErasureCodeLrc.cc b/src/test/erasure-code/TestErasureCodeLrc.cc
index 79385f33944..aca6ccae91f 100644
--- a/src/test/erasure-code/TestErasureCodeLrc.cc
+++ b/src/test/erasure-code/TestErasureCodeLrc.cc
@@ -25,6 +25,7 @@
#include "common/config_proxy.h"
#include "gtest/gtest.h"
+using namespace std;
TEST(ErasureCodeLrc, parse_rule)
{
diff --git a/src/test/erasure-code/TestErasureCodePlugin.cc b/src/test/erasure-code/TestErasureCodePlugin.cc
index c00d2997fbd..e396d946789 100644
--- a/src/test/erasure-code/TestErasureCodePlugin.cc
+++ b/src/test/erasure-code/TestErasureCodePlugin.cc
@@ -24,6 +24,7 @@
#include "common/config_proxy.h"
#include "gtest/gtest.h"
+using namespace std;
class ErasureCodePluginRegistryTest : public ::testing::Test {};
diff --git a/src/test/erasure-code/TestErasureCodePluginClay.cc b/src/test/erasure-code/TestErasureCodePluginClay.cc
index c9297a49fc8..cbf6566dd73 100644
--- a/src/test/erasure-code/TestErasureCodePluginClay.cc
+++ b/src/test/erasure-code/TestErasureCodePluginClay.cc
@@ -22,6 +22,8 @@
#include "common/config_proxy.h"
#include "gtest/gtest.h"
+using namespace std;
+
TEST(ErasureCodePlugin, factory)
{
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
diff --git a/src/test/erasure-code/TestErasureCodePluginIsa.cc b/src/test/erasure-code/TestErasureCodePluginIsa.cc
index b57bf489654..86bac636dcc 100644
--- a/src/test/erasure-code/TestErasureCodePluginIsa.cc
+++ b/src/test/erasure-code/TestErasureCodePluginIsa.cc
@@ -21,6 +21,8 @@
#include "common/config_proxy.h"
#include "gtest/gtest.h"
+using namespace std;
+
TEST(ErasureCodePlugin, factory)
{
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
diff --git a/src/test/erasure-code/TestErasureCodePluginJerasure.cc b/src/test/erasure-code/TestErasureCodePluginJerasure.cc
index 0010d020670..ffe4183bff1 100644
--- a/src/test/erasure-code/TestErasureCodePluginJerasure.cc
+++ b/src/test/erasure-code/TestErasureCodePluginJerasure.cc
@@ -23,6 +23,8 @@
#include "common/config_proxy.h"
#include "gtest/gtest.h"
+using namespace std;
+
TEST(ErasureCodePlugin, factory)
{
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
diff --git a/src/test/erasure-code/TestErasureCodePluginLrc.cc b/src/test/erasure-code/TestErasureCodePluginLrc.cc
index 4df3711a1f1..9be2c336dc5 100644
--- a/src/test/erasure-code/TestErasureCodePluginLrc.cc
+++ b/src/test/erasure-code/TestErasureCodePluginLrc.cc
@@ -24,6 +24,7 @@
#include "common/config_proxy.h"
#include "gtest/gtest.h"
+using namespace std;
TEST(ErasureCodePlugin, factory)
{
diff --git a/src/test/erasure-code/TestErasureCodePluginShec.cc b/src/test/erasure-code/TestErasureCodePluginShec.cc
index 10088343b0a..fae1b559e93 100644
--- a/src/test/erasure-code/TestErasureCodePluginShec.cc
+++ b/src/test/erasure-code/TestErasureCodePluginShec.cc
@@ -23,6 +23,8 @@
#include "gtest/gtest.h"
#include "common/config_proxy.h"
+using namespace std;
+
TEST(ErasureCodePlugin, factory)
{
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
diff --git a/src/test/erasure-code/TestErasureCodeShec.cc b/src/test/erasure-code/TestErasureCodeShec.cc
index 9bc6b8f10dd..6b901dc6f30 100644
--- a/src/test/erasure-code/TestErasureCodeShec.cc
+++ b/src/test/erasure-code/TestErasureCodeShec.cc
@@ -30,6 +30,8 @@
#include "global/global_context.h"
#include "gtest/gtest.h"
+using namespace std;
+
void* thread1(void* pParam);
void* thread2(void* pParam);
void* thread3(void* pParam);
diff --git a/src/test/erasure-code/TestErasureCodeShec_all.cc b/src/test/erasure-code/TestErasureCodeShec_all.cc
index 81a5ac4b077..9ee648aac12 100644
--- a/src/test/erasure-code/TestErasureCodeShec_all.cc
+++ b/src/test/erasure-code/TestErasureCodeShec_all.cc
@@ -31,6 +31,8 @@
#include "global/global_context.h"
#include "gtest/gtest.h"
+using namespace std;
+
struct Param_d {
char* k;
char* m;
diff --git a/src/test/erasure-code/TestErasureCodeShec_arguments.cc b/src/test/erasure-code/TestErasureCodeShec_arguments.cc
index 561afafa6cd..8e3c52a19c0 100644
--- a/src/test/erasure-code/TestErasureCodeShec_arguments.cc
+++ b/src/test/erasure-code/TestErasureCodeShec_arguments.cc
@@ -31,6 +31,8 @@
#include "global/global_context.h"
#include "gtest/gtest.h"
+using namespace std;
+
unsigned int count_num = 0;
unsigned int unexpected_count = 0;
unsigned int value_count = 0;
diff --git a/src/test/erasure-code/TestErasureCodeShec_thread.cc b/src/test/erasure-code/TestErasureCodeShec_thread.cc
index c3e6d8eb308..c8d7bbb1e9a 100644
--- a/src/test/erasure-code/TestErasureCodeShec_thread.cc
+++ b/src/test/erasure-code/TestErasureCodeShec_thread.cc
@@ -30,6 +30,8 @@
#include "global/global_context.h"
#include "gtest/gtest.h"
+using namespace std;
+
void* thread1(void* pParam);
class TestParam {