Merge pull request #13443 from Liuchang0812/cleanup-common

common: add override in common and misc

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-02-16 19:49:53 +08:00 committed by GitHub
commit c623b3eb1a
85 changed files with 382 additions and 382 deletions

View File

@ -67,12 +67,12 @@ uint64_t get_random(uint64_t min_val, uint64_t max_val)
class CryptoNoneKeyHandler : public CryptoKeyHandler {
public:
int encrypt(const bufferlist& in,
bufferlist& out, std::string *error) const {
bufferlist& out, std::string *error) const override {
out = in;
return 0;
}
int decrypt(const bufferlist& in,
bufferlist& out, std::string *error) const {
bufferlist& out, std::string *error) const override {
out = in;
return 0;
}
@ -82,16 +82,16 @@ class CryptoNone : public CryptoHandler {
public:
CryptoNone() { }
~CryptoNone() {}
int get_type() const {
int get_type() const override {
return CEPH_CRYPTO_NONE;
}
int create(bufferptr& secret) {
int create(bufferptr& secret) override {
return 0;
}
int validate_secret(const bufferptr& secret) {
int validate_secret(const bufferptr& secret) override {
return 0;
}
CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error) {
CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error) override {
return new CryptoNoneKeyHandler;
}
};
@ -104,12 +104,12 @@ class CryptoAES : public CryptoHandler {
public:
CryptoAES() { }
~CryptoAES() {}
int get_type() const {
int get_type() const override {
return CEPH_CRYPTO_AES;
}
int create(bufferptr& secret);
int validate_secret(const bufferptr& secret);
CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error);
int create(bufferptr& secret) override;
int validate_secret(const bufferptr& secret) override;
CryptoKeyHandler *get_key_handler(const bufferptr& secret, string& error) override;
};
#ifdef USE_CRYPTOPP
@ -312,11 +312,11 @@ public:
}
int encrypt(const bufferlist& in,
bufferlist& out, std::string *error) const {
bufferlist& out, std::string *error) const override {
return nss_aes_operation(CKA_ENCRYPT, mechanism, key, param, in, out, error);
}
int decrypt(const bufferlist& in,
bufferlist& out, std::string *error) const {
bufferlist& out, std::string *error) const override {
return nss_aes_operation(CKA_DECRYPT, mechanism, key, param, in, out, error);
}
};

View File

@ -149,8 +149,8 @@ int main(int argc, const char **argv, const char *envp[]) {
cfuse = cf;
client = cl;
}
virtual ~RemountTest() {}
virtual void *entry() {
~RemountTest() {}
void *entry() override {
#if defined(__linux__)
int ver = get_linux_version();
assert(ver != 0);

View File

@ -2978,7 +2978,7 @@ private:
InodeRef inode;
public:
C_Client_FlushComplete(Client *c, Inode *in) : client(c), inode(in) { }
void finish(int r) {
void finish(int r) override {
assert(client->client_lock.is_locked_by_me());
if (r != 0) {
client_t const whoami = client->whoami; // For the benefit of ldout prefix
@ -3626,7 +3626,7 @@ public:
else
ino = in->vino();
}
void finish(int r) {
void finish(int r) override {
// _async_invalidate takes the lock when it needs to, call this back from outside of lock.
assert(!client->client_lock.is_locked_by_me());
client->_async_invalidate(ino, offset, length);
@ -3933,7 +3933,7 @@ private:
Client *client;
public:
explicit C_Client_Remount(Client *c) : client(c) {}
void finish(int r) {
void finish(int r) override {
assert (r == 0);
r = client->remount_cb(client->callback_handle);
if (r != 0) {
@ -4828,7 +4828,7 @@ public:
if (!del)
ino.ino = inodeno_t();
}
void finish(int r) {
void finish(int r) override {
// _async_dentry_invalidate is responsible for its own locking
assert(!client->client_lock.is_locked_by_me());
client->_async_dentry_invalidate(dirino, ino, name);
@ -5805,7 +5805,7 @@ class C_C_Tick : public Context {
Client *client;
public:
explicit C_C_Tick(Client *c) : client(c) {}
void finish(int r) {
void finish(int r) override {
// Called back via Timer, which takes client_lock for us
assert(client->client_lock.is_locked_by_me());
client->tick();
@ -12434,7 +12434,7 @@ public:
C_Client_RequestInterrupt(Client *c, MetaRequest *r) : client(c), req(r) {
req->get();
}
void finish(int r) {
void finish(int r) override {
Mutex::Locker l(client->client_lock);
assert(req->head.op == CEPH_MDS_OP_SETFILELOCK);
client->_interrupt_filelock(req);

View File

@ -2221,7 +2221,7 @@ public:
(*ref)++;
lock.Unlock();
}
void finish(int) {
void finish(int) override {
lock.Lock();
(*ref)--;
cond.Signal();

View File

@ -127,7 +127,7 @@ class PGLSCephFSFilter : public PGLSFilter {
protected:
std::string scrub_tag;
public:
int init(bufferlist::iterator& params) {
int init(bufferlist::iterator& params) override {
try {
InodeTagFilterArgs args;
args.decode(params);
@ -145,10 +145,10 @@ public:
return 0;
}
virtual ~PGLSCephFSFilter() {}
virtual bool reject_empty_xattr() { return false; }
virtual bool filter(const hobject_t &obj, bufferlist& xattr_data,
bufferlist& outdata);
~PGLSCephFSFilter() {}
bool reject_empty_xattr() override { return false; }
bool filter(const hobject_t &obj, bufferlist& xattr_data,
bufferlist& outdata) override;
};
bool PGLSCephFSFilter::filter(const hobject_t &obj,

View File

@ -252,7 +252,7 @@ static int bad_writer(cls_method_context_t hctx, bufferlist *in, bufferlist *out
class PGLSHelloFilter : public PGLSFilter {
string val;
public:
int init(bufferlist::iterator& params) {
int init(bufferlist::iterator& params) override {
try {
::decode(xattr, params);
::decode(val, params);
@ -262,9 +262,9 @@ public:
return 0;
}
virtual ~PGLSHelloFilter() {}
virtual bool filter(const hobject_t &obj, bufferlist& xattr_data,
bufferlist& outdata)
~PGLSHelloFilter() {}
bool filter(const hobject_t &obj, bufferlist& xattr_data,
bufferlist& outdata) override
{
if (val.size() != xattr_data.length())
return false;

View File

@ -54,7 +54,7 @@ struct C_ClientList : public C_AioExec {
rados_completion->release();
}
virtual void complete(int r) {
void complete(int r) override {
if (r < 0) {
finish(r);
return;
@ -81,7 +81,7 @@ struct C_ClientList : public C_AioExec {
}
}
virtual void finish(int r) {
void finish(int r) override {
on_finish->complete(r);
delete this;
}
@ -115,7 +115,7 @@ struct C_ImmutableMetadata : public C_AioExec {
rados_completion->release();
}
virtual void finish(int r) {
void finish(int r) override {
if (r == 0) {
try {
bufferlist::iterator iter = outbl.begin();
@ -155,7 +155,7 @@ struct C_MutableMetadata : public C_AioExec {
rados_completion->release();
}
virtual void finish(int r) {
void finish(int r) override {
if (r == 0) {
try {
bufferlist::iterator iter = outbl.begin();

View File

@ -88,7 +88,7 @@ class LogListCtx : public ObjectOperationCompletion {
public:
LogListCtx(list<cls_log_entry> *_entries, string *_marker, bool *_truncated) :
entries(_entries), marker(_marker), truncated(_truncated) {}
void handle_completion(int r, bufferlist& outbl) {
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
cls_log_list_ret ret;
try {
@ -128,7 +128,7 @@ class LogInfoCtx : public ObjectOperationCompletion {
cls_log_header *header;
public:
explicit LogInfoCtx(cls_log_header *_header) : header(_header) {}
void handle_completion(int r, bufferlist& outbl) {
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
cls_log_info_ret ret;
try {

View File

@ -74,7 +74,7 @@ class StateLogListCtx : public ObjectOperationCompletion {
public:
StateLogListCtx(list<cls_statelog_entry> *_entries, string *_marker, bool *_truncated) :
entries(_entries), marker(_marker), truncated(_truncated) {}
void handle_completion(int r, bufferlist& outbl) {
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
cls_statelog_list_ret ret;
try {

View File

@ -111,7 +111,7 @@ public:
bool *_truncated)
: entries(_entries), marker(_marker), truncated(_truncated) {}
void handle_completion(int r, bufferlist& outbl) {
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
cls_timeindex_list_ret ret;
try {

View File

@ -49,7 +49,7 @@ class ClsUserListCtx : public ObjectOperationCompletion {
public:
ClsUserListCtx(list<cls_user_bucket_entry> *_entries, string *_marker, bool *_truncated, int *_pret) :
entries(_entries), marker(_marker), truncated(_truncated), pret(_pret) {}
void handle_completion(int r, bufferlist& outbl) {
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
cls_user_list_buckets_ret ret;
try {
@ -102,7 +102,7 @@ public:
ret_ctx->put();
}
}
void handle_completion(int r, bufferlist& outbl) {
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
cls_user_get_header_ret ret;
try {

View File

@ -61,7 +61,7 @@ class VersionReadCtx : public ObjectOperationCompletion {
obj_version *objv;
public:
explicit VersionReadCtx(obj_version *_objv) : objv(_objv) {}
void handle_completion(int r, bufferlist& outbl) {
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
cls_version_read_ret ret;
try {

View File

@ -34,7 +34,7 @@ class SafeTimerThread : public Thread {
SafeTimer *parent;
public:
explicit SafeTimerThread(SafeTimer *s) : parent(s) {}
void *entry() {
void *entry() override {
parent->timer_thread();
return NULL;
}

View File

@ -488,8 +488,8 @@ int AdminSocket::unregister_command(std::string command)
class VersionHook : public AdminSocketHook {
public:
virtual bool call(std::string command, cmdmap_t &cmdmap, std::string format,
bufferlist& out) {
bool call(std::string command, cmdmap_t &cmdmap, std::string format,
bufferlist& out) override {
if (command == "0") {
out.append(CEPH_ADMIN_SOCK_VERSION);
} else {
@ -512,7 +512,7 @@ class HelpHook : public AdminSocketHook {
AdminSocket *m_as;
public:
explicit HelpHook(AdminSocket *as) : m_as(as) {}
bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) {
bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) override {
Formatter *f = Formatter::create(format, "json-pretty", "json-pretty");
f->open_object_section("help");
for (map<string,string>::iterator p = m_as->m_help.begin();
@ -534,7 +534,7 @@ class GetdescsHook : public AdminSocketHook {
AdminSocket *m_as;
public:
explicit GetdescsHook(AdminSocket *as) : m_as(as) {}
bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) {
bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) override {
int cmdnum = 0;
JSONFormatter jf(false);
jf.open_object_section("command_descriptions");

View File

@ -258,7 +258,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
~raw_combined() {
dec_total_alloc(len);
}
raw* clone_empty() {
raw* clone_empty() override {
return create(len, alignment);
}
@ -314,7 +314,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
dec_total_alloc(len);
bdout << "raw_malloc " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl;
}
raw* clone_empty() {
raw* clone_empty() override {
return new raw_malloc(len);
}
};
@ -337,7 +337,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
dec_total_alloc(len);
bdout << "raw_mmap " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl;
}
raw* clone_empty() {
raw* clone_empty() override {
return new raw_mmap_pages(len);
}
};
@ -362,7 +362,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
dec_total_alloc(len);
bdout << "raw_posix_aligned " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl;
}
raw* clone_empty() {
raw* clone_empty() override {
return new raw_posix_aligned(len, align);
}
};
@ -448,7 +448,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
<< buffer::get_total_alloc() << bendl;
}
bool can_zero_copy() const {
bool can_zero_copy() const override {
return true;
}
@ -465,7 +465,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
return 0;
}
int zero_copy_to_fd(int fd, loff_t *offset) {
int zero_copy_to_fd(int fd, loff_t *offset) override {
assert(!source_consumed);
int flags = SPLICE_F_NONBLOCK;
ssize_t r = safe_splice_exact(pipefds[0], NULL, fd, offset, len, flags);
@ -478,13 +478,13 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
return 0;
}
buffer::raw* clone_empty() {
buffer::raw* clone_empty() override {
// cloning doesn't make sense for pipe-based buffers,
// and is only used by unit tests for other types of buffers
return NULL;
}
char *get_data() {
char *get_data() override {
if (data)
return data;
return copy_pipe(pipefds);
@ -601,7 +601,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
dec_total_alloc(len);
bdout << "raw_char " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl;
}
raw* clone_empty() {
raw* clone_empty() override {
return new raw_char(len);
}
};
@ -618,10 +618,10 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
}
raw_unshareable(unsigned l, char *b) : raw(b, l) {
}
raw* clone_empty() {
raw* clone_empty() override {
return new raw_char(len);
}
bool is_shareable() {
bool is_shareable() override {
return false; // !shareable, will force make_shareable()
}
~raw_unshareable() {
@ -635,7 +635,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
raw_static(const char *d, unsigned l) : raw((char*)d, l) { }
~raw_static() {}
raw* clone_empty() {
raw* clone_empty() override {
return new buffer::raw_char(len);
}
};
@ -646,7 +646,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
raw_claim_buffer(const char *b, unsigned l, deleter d)
: raw((char*)b, l), del(std::move(d)) { }
~raw_claim_buffer() {}
raw* clone_empty() {
raw* clone_empty() override {
return new buffer::raw_char(len);
}
};

View File

@ -51,19 +51,19 @@ class LockdepObs : public md_config_obs_t {
public:
explicit LockdepObs(CephContext *cct) : m_cct(cct), m_registered(false) {
}
virtual ~LockdepObs() {
~LockdepObs() {
if (m_registered) {
lockdep_unregister_ceph_context(m_cct);
}
}
const char** get_tracked_conf_keys() const {
const char** get_tracked_conf_keys() const override {
static const char *KEYS[] = {"lockdep", NULL};
return KEYS;
}
void handle_conf_change(const md_config_t *conf,
const std::set <std::string> &changed) {
const std::set <std::string> &changed) override {
if (conf->lockdep && !m_registered) {
lockdep_register_ceph_context(m_cct);
m_registered = true;
@ -97,7 +97,7 @@ public:
}
// md_config_obs_t
const char** get_tracked_conf_keys() const {
const char** get_tracked_conf_keys() const override {
static const char *KEYS[] = {
"mempool_debug",
NULL
@ -106,7 +106,7 @@ public:
}
void handle_conf_change(const md_config_t *conf,
const std::set <std::string> &changed) {
const std::set <std::string> &changed) override {
if (changed.count("mempool_debug")) {
mempool::set_debug_mode(cct->_conf->mempool_debug);
}
@ -114,7 +114,7 @@ public:
// AdminSocketHook
bool call(std::string command, cmdmap_t& cmdmap, std::string format,
bufferlist& out) {
bufferlist& out) override {
if (command == "dump_mempools") {
std::unique_ptr<Formatter> f(Formatter::create(format));
f->open_object_section("mempools");
@ -140,7 +140,7 @@ public:
~CephContextServiceThread() {}
void *entry()
void *entry() override
{
while (1) {
Mutex::Locker l(_lock);
@ -203,7 +203,7 @@ class LogObs : public md_config_obs_t {
public:
explicit LogObs(ceph::logging::Log *l) : log(l) {}
const char** get_tracked_conf_keys() const {
const char** get_tracked_conf_keys() const override {
static const char *KEYS[] = {
"log_file",
"log_max_new",
@ -224,7 +224,7 @@ public:
}
void handle_conf_change(const md_config_t *conf,
const std::set <std::string> &changed) {
const std::set <std::string> &changed) override {
// stderr
if (changed.count("log_to_stderr") || changed.count("err_to_stderr")) {
int l = conf->log_to_stderr ? 99 : (conf->err_to_stderr ? -1 : -2);
@ -287,7 +287,7 @@ class CephContextObs : public md_config_obs_t {
public:
explicit CephContextObs(CephContext *cct) : cct(cct) {}
const char** get_tracked_conf_keys() const {
const char** get_tracked_conf_keys() const override {
static const char *KEYS[] = {
"enable_experimental_unrecoverable_data_corrupting_features",
"crush_location",
@ -297,7 +297,7 @@ public:
}
void handle_conf_change(const md_config_t *conf,
const std::set <std::string> &changed) {
const std::set <std::string> &changed) override {
if (changed.count(
"enable_experimental_unrecoverable_data_corrupting_features")) {
ceph_spin_lock(&cct->_feature_lock);
@ -364,7 +364,7 @@ public:
explicit CephContextHook(CephContext *cct) : m_cct(cct) {}
bool call(std::string command, cmdmap_t& cmdmap, std::string format,
bufferlist& out) {
bufferlist& out) override {
m_cct->do_command(command, cmdmap, format, &out);
return true;
}

View File

@ -56,11 +56,11 @@ struct Observer : public md_config_obs_t {
keys[1] = NULL;
}
const char** get_tracked_conf_keys() const {
const char** get_tracked_conf_keys() const override {
return (const char **)keys;
}
void handle_conf_change(const struct md_config_t *conf,
const std::set <std::string> &changed) {
const std::set <std::string> &changed) override {
// do nothing.
}
};

View File

@ -417,7 +417,7 @@ namespace {
public:
CrushWalker(const CrushWrapper *crush, unsigned max_id)
: Parent(crush), max_id(max_id) {}
void dump_item(const CrushTreeDumper::Item &qi, DumbFormatter *) {
void dump_item(const CrushTreeDumper::Item &qi, DumbFormatter *) override {
int type = -1;
if (qi.is_bucket()) {
if (!crush->get_item_name(qi.id)) {

View File

@ -1687,7 +1687,7 @@ public:
}
protected:
virtual void dump_item(const CrushTreeDumper::Item &qi, ostream *out) {
void dump_item(const CrushTreeDumper::Item &qi, ostream *out) override {
*out << qi.id << "\t"
<< weightf_t(qi.weight) << "\t";

View File

@ -256,7 +256,7 @@ struct SignalHandler : public Thread {
}
// thread entry point
void *entry() {
void *entry() override {
while (!stop) {
// build fd list
struct pollfd fds[33];

View File

@ -37,7 +37,7 @@ struct C_GetClient : public Context {
client_id(client_id), client(client), on_finish(on_finish) {
async_op_tracker.start_op();
}
virtual ~C_GetClient() {
~C_GetClient() {
async_op_tracker.finish_op();
}
@ -70,7 +70,7 @@ struct C_GetClient : public Context {
complete(r);
}
virtual void finish(int r) override {
void finish(int r) override {
on_finish->complete(r);
}
};
@ -95,7 +95,7 @@ struct C_AllocateTag : public Context {
async_op_tracker.start_op();
tag->data = data;
}
virtual ~C_AllocateTag() {
~C_AllocateTag() {
async_op_tracker.finish_op();
}
@ -193,7 +193,7 @@ struct C_AllocateTag : public Context {
complete(r);
}
virtual void finish(int r) override {
void finish(int r) override {
on_finish->complete(r);
}
};
@ -216,7 +216,7 @@ struct C_GetTag : public Context {
tag_tid(tag_tid), tag(tag), on_finish(on_finish) {
async_op_tracker.start_op();
}
virtual ~C_GetTag() {
~C_GetTag() {
async_op_tracker.finish_op();
}
@ -245,7 +245,7 @@ struct C_GetTag : public Context {
complete(r);
}
virtual void finish(int r) override {
void finish(int r) override {
on_finish->complete(r);
}
};
@ -275,7 +275,7 @@ struct C_GetTags : public Context {
tags(tags), on_finish(on_finish) {
async_op_tracker.start_op();
}
virtual ~C_GetTags() {
~C_GetTags() {
async_op_tracker.finish_op();
}
@ -318,7 +318,7 @@ struct C_GetTags : public Context {
complete(r);
}
virtual void finish(int r) override {
void finish(int r) override {
on_finish->complete(r);
}
};
@ -330,7 +330,7 @@ struct C_FlushCommitPosition : public Context {
C_FlushCommitPosition(Context *commit_position_ctx, Context *on_finish)
: commit_position_ctx(commit_position_ctx), on_finish(on_finish) {
}
virtual void finish(int r) override {
void finish(int r) override {
if (commit_position_ctx != nullptr) {
commit_position_ctx->complete(r);
}
@ -357,7 +357,7 @@ struct C_AssertActiveTag : public Context {
client_id(client_id), tag_tid(tag_tid), on_finish(on_finish) {
async_op_tracker.start_op();
}
virtual ~C_AssertActiveTag() {
~C_AssertActiveTag() {
async_op_tracker.finish_op();
}
@ -393,7 +393,7 @@ struct C_AssertActiveTag : public Context {
complete(r);
}
virtual void finish(int r) {
void finish(int r) override {
on_finish->complete(r);
}
};

View File

@ -21,10 +21,10 @@ struct C_HandleComplete : public Context {
: replay_handler(_replay_handler) {
replay_handler->get();
}
virtual ~C_HandleComplete() {
~C_HandleComplete() {
replay_handler->put();
}
virtual void finish(int r) {
void finish(int r) override {
replay_handler->handle_complete(r);
}
};
@ -36,10 +36,10 @@ struct C_HandleEntriesAvailable : public Context {
: replay_handler(_replay_handler) {
replay_handler->get();
}
virtual ~C_HandleEntriesAvailable() {
~C_HandleEntriesAvailable() {
replay_handler->put();
}
virtual void finish(int r) {
void finish(int r) override {
replay_handler->handle_entries_available();
}
};

View File

@ -28,7 +28,7 @@ struct C_Flush : public Context {
pending_flushes(_pending_flushes), ret_val(0) {
}
virtual void complete(int r) {
void complete(int r) override {
if (r < 0 && ret_val == 0) {
ret_val = r;
}
@ -38,7 +38,7 @@ struct C_Flush : public Context {
delete this;
}
}
virtual void finish(int r) {
void finish(int r) override {
}
};

View File

@ -22,8 +22,8 @@ struct JournalTrimmer::C_RemoveSet : public Context {
C_RemoveSet(JournalTrimmer *_journal_trimmer, uint64_t _object_set,
uint8_t _splay_width);
virtual void complete(int r);
virtual void finish(int r) {
void complete(int r) override;
void finish(int r) override {
journal_trimmer->handle_set_removed(r, object_set);
journal_trimmer->m_async_op_tracker.finish_op();
}

View File

@ -27,7 +27,7 @@ public:
}
// Write an entry to the log file with the specified format.
void Logv(const char* format, va_list ap) {
void Logv(const char* format, va_list ap) override {
dout(1);
char buf[65536];
vsnprintf(buf, sizeof(buf), format, ap);

View File

@ -40,7 +40,7 @@ using std::string;
class RocksDBStore::MergeOperatorRouter : public rocksdb::AssociativeMergeOperator {
RocksDBStore& store;
public:
const char *Name() const {
const char *Name() const override {
// Construct a name that rocksDB will validate against. We want to
// do this in a way that doesn't constrain the ordering of calls
// to set_merge_operator, so sort the merge operators and then
@ -59,11 +59,11 @@ class RocksDBStore::MergeOperatorRouter : public rocksdb::AssociativeMergeOperat
MergeOperatorRouter(RocksDBStore &_store) : store(_store) {}
virtual bool Merge(const rocksdb::Slice& key,
bool Merge(const rocksdb::Slice& key,
const rocksdb::Slice* existing_value,
const rocksdb::Slice& value,
std::string* new_value,
rocksdb::Logger* logger) const {
rocksdb::Logger* logger) const override {
// Check each prefix
for (auto& p : store.merge_ops) {
if (p.first.compare(0, p.first.length(),
@ -105,7 +105,7 @@ public:
}
// Write an entry to the log file with the specified format.
void Logv(const char* format, va_list ap) {
void Logv(const char* format, va_list ap) override {
Logv(rocksdb::INFO_LEVEL, format, ap);
}
@ -114,7 +114,7 @@ public:
// of *this (see @SetInfoLogLevel and @GetInfoLogLevel) will not be
// printed.
void Logv(const rocksdb::InfoLogLevel log_level, const char* format,
va_list ap) {
va_list ap) override {
int v = rocksdb::NUM_INFO_LOG_LEVELS - log_level - 1;
dout(v);
char buf[65536];

View File

@ -52,7 +52,7 @@ class C_time_wakeup : public EventCallback {
public:
explicit C_time_wakeup(AsyncConnectionRef c): conn(c) {}
void do_request(int fd_or_id) {
void do_request(int fd_or_id) override {
conn->wakeup_from(fd_or_id);
}
};
@ -62,7 +62,7 @@ class C_handle_read : public EventCallback {
public:
explicit C_handle_read(AsyncConnectionRef c): conn(c) {}
void do_request(int fd_or_id) {
void do_request(int fd_or_id) override {
conn->process();
}
};
@ -72,7 +72,7 @@ class C_handle_write : public EventCallback {
public:
explicit C_handle_write(AsyncConnectionRef c): conn(c) {}
void do_request(int fd) {
void do_request(int fd) override {
conn->handle_write();
}
};
@ -81,7 +81,7 @@ class C_clean_handler : public EventCallback {
AsyncConnectionRef conn;
public:
explicit C_clean_handler(AsyncConnectionRef c): conn(c) {}
void do_request(int id) {
void do_request(int id) override {
conn->cleanup();
delete this;
}
@ -92,7 +92,7 @@ class C_tick_wakeup : public EventCallback {
public:
explicit C_tick_wakeup(AsyncConnectionRef c): conn(c) {}
void do_request(int fd_or_id) {
void do_request(int fd_or_id) override {
conn->tick(fd_or_id);
}
};

View File

@ -50,7 +50,7 @@ class Processor::C_processor_accept : public EventCallback {
public:
explicit C_processor_accept(Processor *p): pro(p) {}
void do_request(int id) {
void do_request(int id) override {
pro->accept();
}
};
@ -232,7 +232,7 @@ class C_handle_reap : public EventCallback {
public:
explicit C_handle_reap(AsyncMessenger *m): msgr(m) {}
void do_request(int id) {
void do_request(int id) override {
// judge whether is a time event
msgr->reap_dead();
}

View File

@ -41,7 +41,7 @@ class C_handle_notify : public EventCallback {
public:
C_handle_notify(EventCenter *c, CephContext *cc): center(c), cct(cc) {}
void do_request(int fd_or_id) {
void do_request(int fd_or_id) override {
char c[256];
int r = 0;
do {

View File

@ -52,7 +52,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl {
explicit PosixConnectedSocketImpl(NetHandler &h, const entity_addr_t &sa, int f, bool connected)
: handler(h), _fd(f), sa(sa), connected(connected) {}
virtual int is_connected() override {
int is_connected() override {
if (connected)
return 1;
@ -67,11 +67,11 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl {
}
}
virtual ssize_t zero_copy_read(bufferptr&) override {
ssize_t zero_copy_read(bufferptr&) override {
return -EOPNOTSUPP;
}
virtual ssize_t read(char *buf, size_t len) override {
ssize_t read(char *buf, size_t len) override {
ssize_t r = ::read(_fd, buf, len);
if (r < 0)
r = -errno;
@ -184,7 +184,7 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl {
return (ssize_t)sent;
}
virtual ssize_t send(bufferlist &bl, bool more) {
ssize_t send(bufferlist &bl, bool more) override {
size_t sent_bytes = 0;
std::list<bufferptr>::const_iterator pb = bl.buffers().begin();
uint64_t left_pbrs = bl.buffers().size();
@ -229,13 +229,13 @@ class PosixConnectedSocketImpl final : public ConnectedSocketImpl {
return static_cast<ssize_t>(sent_bytes);
}
virtual void shutdown() {
void shutdown() override {
::shutdown(_fd, SHUT_RDWR);
}
virtual void close() {
void close() override {
::close(_fd);
}
virtual int fd() const override {
int fd() const override {
return _fd;
}
friend class PosixServerSocketImpl;
@ -248,11 +248,11 @@ class PosixServerSocketImpl : public ServerSocketImpl {
public:
explicit PosixServerSocketImpl(NetHandler &h, int f): handler(h), _fd(f) {}
virtual int accept(ConnectedSocket *sock, const SocketOptions &opts, entity_addr_t *out, Worker *w) override;
virtual void abort_accept() override {
int accept(ConnectedSocket *sock, const SocketOptions &opts, entity_addr_t *out, Worker *w) override;
void abort_accept() override {
::close(_fd);
}
virtual int fd() const override {
int fd() const override {
return _fd;
}
};

View File

@ -180,7 +180,7 @@ class C_drain : public EventCallback {
explicit C_drain(size_t c)
: drain_lock("C_drain::drain_lock"),
drain_count(c) {}
void do_request(int id) {
void do_request(int id) override {
Mutex::Locker l(drain_lock);
drain_count--;
if (drain_count == 0) drain_cond.Signal();

View File

@ -88,7 +88,7 @@ public:
~DelayedDelivery() {
discard();
}
void *entry();
void *entry() override;
void queue(utime_t release, Message *m) {
Mutex::Locker l(delay_lock);
delay_queue.push_back(make_pair(release, m));

View File

@ -27,9 +27,9 @@ protected:
public:
explicit WholeSpaceMemIterator(KeyValueDBMemory *db) : db(db), ready(false) { }
virtual ~WholeSpaceMemIterator() { }
~WholeSpaceMemIterator() { }
int seek_to_first() {
int seek_to_first() override {
if (db->db.empty()) {
it = db->db.end();
ready = false;
@ -40,7 +40,7 @@ public:
return 0;
}
int seek_to_first(const string &prefix) {
int seek_to_first(const string &prefix) override {
it = db->db.lower_bound(make_pair(prefix, ""));
if (db->db.empty() || (it == db->db.end())) {
it = db->db.end();
@ -51,7 +51,7 @@ public:
return 0;
}
int seek_to_last() {
int seek_to_last() override {
it = db->db.end();
if (db->db.empty()) {
ready = false;
@ -63,7 +63,7 @@ public:
return 0;
}
int seek_to_last(const string &prefix) {
int seek_to_last(const string &prefix) override {
string tmp(prefix);
tmp.append(1, (char) 0);
it = db->db.upper_bound(make_pair(tmp,""));
@ -78,7 +78,7 @@ public:
return 0;
}
int lower_bound(const string &prefix, const string &to) {
int lower_bound(const string &prefix, const string &to) override {
it = db->db.lower_bound(make_pair(prefix,to));
if ((db->db.empty()) || (it == db->db.end())) {
it = db->db.end();
@ -92,7 +92,7 @@ public:
return 0;
}
int upper_bound(const string &prefix, const string &after) {
int upper_bound(const string &prefix, const string &after) override {
it = db->db.upper_bound(make_pair(prefix,after));
if ((db->db.empty()) || (it == db->db.end())) {
it = db->db.end();
@ -104,7 +104,7 @@ public:
return 0;
}
bool valid() {
bool valid() override {
return ready && (it != db->db.end());
}
@ -112,7 +112,7 @@ public:
return ready && (it == db->db.begin());
}
int prev() {
int prev() override {
if (!begin() && ready)
--it;
else
@ -120,38 +120,38 @@ public:
return 0;
}
int next() {
int next() override {
if (valid())
++it;
return 0;
}
string key() {
string key() override {
if (valid())
return (*it).first.second;
else
return "";
}
pair<string,string> raw_key() {
pair<string,string> raw_key() override {
if (valid())
return (*it).first;
else
return make_pair("", "");
}
bool raw_key_is_prefixed(const string &prefix) {
bool raw_key_is_prefixed(const string &prefix) override {
return prefix == (*it).first.first;
}
bufferlist value() {
bufferlist value() override {
if (valid())
return (*it).second;
else
return bufferlist();
}
int status() {
int status() override {
return 0;
}
};

View File

@ -33,7 +33,7 @@ public:
boost::scoped_ptr<KeyValueDB> db;
boost::scoped_ptr<KeyValueDBMemory> mock;
virtual void SetUp() {
void SetUp() override {
assert(!store_path.empty());
KeyValueDB *db_ptr = KeyValueDB::create(g_ceph_context, "leveldb", store_path);
@ -42,7 +42,7 @@ public:
mock.reset(new KeyValueDBMemory());
}
virtual void TearDown() { }
void TearDown() override { }
::testing::AssertionResult validate_db_clear(KeyValueDB *store) {
KeyValueDB::WholeSpaceIterator it = store->get_iterator();
@ -274,7 +274,7 @@ public:
db->submit_transaction_sync(tx);
}
virtual void SetUp() {
void SetUp() override {
IteratorTest::SetUp();
prefix1 = "_PREFIX_1_";
@ -292,7 +292,7 @@ public:
ASSERT_TRUE(validate_db_match());
}
virtual void TearDown() {
void TearDown() override {
IteratorTest::TearDown();
}
@ -543,7 +543,7 @@ public:
db->submit_transaction_sync(tx);
}
virtual void SetUp() {
void SetUp() override {
IteratorTest::SetUp();
prefix1 = "_PREFIX_1_";
@ -560,7 +560,7 @@ public:
ASSERT_TRUE(validate_db_match());
}
virtual void TearDown() {
void TearDown() override {
IteratorTest::TearDown();
}
@ -786,7 +786,7 @@ public:
store->submit_transaction_sync(tx);
}
virtual void SetUp() {
void SetUp() override {
IteratorTest::SetUp();
prefix1 = "_PREFIX_1_";
@ -804,7 +804,7 @@ public:
ASSERT_TRUE(validate_db_match());
}
virtual void TearDown() {
void TearDown() override {
IteratorTest::TearDown();
}
@ -1257,7 +1257,7 @@ public:
store->submit_transaction_sync(tx);
}
virtual void SetUp() {
void SetUp() override {
IteratorTest::SetUp();
prefix0 = "_PREFIX_0_";
@ -1278,7 +1278,7 @@ public:
ASSERT_TRUE(validate_db_match());
}
virtual void TearDown() {
void TearDown() override {
IteratorTest::TearDown();
}
@ -1519,7 +1519,7 @@ public:
store->submit_transaction_sync(tx);
}
virtual void SetUp() {
void SetUp() override {
IteratorTest::SetUp();
prefix1 = "_PREFIX_1_";
@ -1535,7 +1535,7 @@ public:
ASSERT_TRUE(validate_db_match());
}
virtual void TearDown() {
void TearDown() override {
IteratorTest::TearDown();
}
@ -1591,7 +1591,7 @@ TEST_F(KeySpaceIteration, BackwardIterationMockDB) {
class EmptyStore : public IteratorTest
{
public:
virtual void SetUp() {
void SetUp() override {
IteratorTest::SetUp();
clear(db.get());

View File

@ -522,7 +522,7 @@ class ObjectMapTest : public ::testing::Test {
public:
boost::scoped_ptr< ObjectMap > db;
ObjectMapTester tester;
virtual void SetUp() {
void SetUp() override {
char *path = getenv("OBJECT_MAP_PATH");
if (!path) {
db.reset(new DBObjectMap(g_ceph_context, new KeyValueDBMemory()));
@ -540,7 +540,7 @@ public:
tester.db = db.get();
}
virtual void TearDown() {
void TearDown() override {
std::cerr << "Checking..." << std::endl;
assert(db->check(std::cerr));
}

View File

@ -31,7 +31,7 @@ public:
{
}
virtual void finish(int r)
void finish(int r) override
{
array_lock.Lock();
cout << "TestContext " << num << std::endl;
@ -39,7 +39,7 @@ public:
array_lock.Unlock();
}
virtual ~TestContext()
~TestContext()
{
}
@ -55,7 +55,7 @@ public:
{
}
virtual void finish(int r)
void finish(int r) override
{
array_lock.Lock();
cout << "StrictOrderTestContext " << num << std::endl;
@ -63,7 +63,7 @@ public:
array_lock.Unlock();
}
virtual ~StrictOrderTestContext()
~StrictOrderTestContext()
{
}
};

View File

@ -120,7 +120,7 @@ TEST(AdminSocket, SendTooLongRequest) {
}
class MyTest : public AdminSocketHook {
bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) {
bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) override {
std::vector<std::string> args;
cmd_getval(g_ceph_context, cmdmap, "args", args);
result.append(command);
@ -152,7 +152,7 @@ TEST(AdminSocket, RegisterCommand) {
}
class MyTest2 : public AdminSocketHook {
bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) {
bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) override {
std::vector<std::string> args;
cmd_getval(g_ceph_context, cmdmap, "args", args);
result.append(command);
@ -204,7 +204,7 @@ public:
BlockingHook() : _lock("BlockingHook::_lock") {}
bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) {
bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& result) override {
Mutex::Locker l(_lock);
_cond.Wait(_lock);
return true;

View File

@ -13,7 +13,7 @@ struct C_Holder : public Context {
explicit C_Holder(
T obj)
: obj(obj) {}
void finish(int r) {
void finish(int r) override {
return;
}
};
@ -27,7 +27,7 @@ struct OnDelete {
struct Cleanup : public Context {
Bencher *bench;
explicit Cleanup(Bencher *bench) : bench(bench) {}
void finish(int r) {
void finish(int r) override {
bench->complete_op();
}
};
@ -40,7 +40,7 @@ struct OnWriteApplied : public Context {
Bencher *bench, uint64_t seq,
ceph::shared_ptr<OnDelete> on_delete
) : bench(bench), seq(seq), on_delete(on_delete) {}
void finish(int r) {
void finish(int r) override {
bench->stat_collector->write_applied(seq);
}
};
@ -53,7 +53,7 @@ struct OnWriteCommit : public Context {
Bencher *bench, uint64_t seq,
ceph::shared_ptr<OnDelete> on_delete
) : bench(bench), seq(seq), on_delete(on_delete) {}
void finish(int r) {
void finish(int r) override {
bench->stat_collector->write_committed(seq);
}
};
@ -64,7 +64,7 @@ struct OnReadComplete : public Context {
boost::scoped_ptr<bufferlist> bl;
OnReadComplete(Bencher *bench, uint64_t seq, bufferlist *bl) :
bench(bench), seq(seq), bl(bl) {}
void finish(int r) {
void finish(int r) override {
bench->stat_collector->read_complete(seq);
bench->complete_op();
}

View File

@ -30,7 +30,7 @@ using namespace std;
struct MorePrinting : public DetailedStatCollector::AdditionalPrinting {
CephContext *cct;
explicit MorePrinting(CephContext *cct) : cct(cct) {}
void operator()(std::ostream *out) {
void operator()(std::ostream *out) override {
bufferlist bl;
Formatter *f = Formatter::create("json-pretty");
cct->get_perfcounters_collection()->dump_formatted(f, 0);

View File

@ -39,13 +39,13 @@ class Base : public Queueable {
public:
Base(DetailedStatCollector *col,
Semaphore *sem) : col(col), sem(sem) {}
void queue(unsigned *item) {
void queue(unsigned *item) override {
col->read_complete(*item);
sem->Put();
delete item;
}
void start() {}
void stop() {}
void start() override {}
void stop() override {}
};
class WQWrapper : public Queueable {
boost::scoped_ptr<ThreadPool::WorkQueue<unsigned> > wq;
@ -53,9 +53,9 @@ class WQWrapper : public Queueable {
public:
WQWrapper(ThreadPool::WorkQueue<unsigned> *wq, ThreadPool *tp):
wq(wq), tp(tp) {}
void queue(unsigned *item) { wq->queue(item); }
void start() { tp->start(); }
void stop() { tp->stop(); }
void queue(unsigned *item) override { wq->queue(item); }
void start() override { tp->start(); }
void stop() override { tp->stop(); }
};
class FinisherWrapper : public Queueable {
class CB : public Context {
@ -63,7 +63,7 @@ class FinisherWrapper : public Queueable {
unsigned *item;
public:
CB(Queueable *next, unsigned *item) : next(next), item(item) {}
void finish(int) {
void finish(int) override {
next->queue(item);
}
};
@ -72,21 +72,21 @@ class FinisherWrapper : public Queueable {
public:
FinisherWrapper(CephContext *cct, Queueable *next) :
f(cct), next(next) {}
void queue(unsigned *item) {
void queue(unsigned *item) override {
f.queue(new CB(next, item));
}
void start() { f.start(); }
void stop() { f.stop(); }
void start() override { f.start(); }
void stop() override { f.stop(); }
};
class PassAlong : public ThreadPool::WorkQueue<unsigned> {
Queueable *next;
list<unsigned*> q;
bool _enqueue(unsigned *item) {
bool _enqueue(unsigned *item) override {
q.push_back(item);
return true;
}
void _dequeue(unsigned *item) { ceph_abort(); }
unsigned *_dequeue() {
void _dequeue(unsigned *item) override { ceph_abort(); }
unsigned *_dequeue() override {
if (q.empty())
return 0;
unsigned *val = q.front();
@ -96,8 +96,8 @@ class PassAlong : public ThreadPool::WorkQueue<unsigned> {
void _process(unsigned *item, ThreadPool::TPHandle &) override {
next->queue(item);
}
void _clear() { q.clear(); }
bool _empty() { return q.empty(); }
void _clear() override { q.clear(); }
bool _empty() override { return q.empty(); }
public:
PassAlong(ThreadPool *tp, Queueable *_next) :
ThreadPool::WorkQueue<unsigned>("TestQueue", 100, 100, tp), next(_next) {}

View File

@ -22,7 +22,7 @@ struct T : public Thread {
mymap[10] = "bar";
}
void *entry() {
void *entry() override {
while (num-- > 0)
generic_dout(0) << "this is a typical log line. set "
<< myset << " and map " << mymap << dendl;

View File

@ -249,7 +249,7 @@ TEST(BufferRaw, ostream) {
#ifdef CEPH_HAVE_SPLICE
class TestRawPipe : public ::testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
len = 4;
::unlink(FILENAME);
snprintf(cmd, sizeof(cmd), "echo ABC > %s", FILENAME);
@ -257,7 +257,7 @@ protected:
fd = ::open(FILENAME, O_RDONLY);
assert(fd >= 0);
}
virtual void TearDown() {
void TearDown() override {
::close(fd);
::unlink(FILENAME);
}

View File

@ -7,7 +7,7 @@
class CryptoEnvironment: public ::testing::Environment {
public:
void SetUp() {
void SetUp() override {
ceph::crypto::init(g_ceph_context);
}
};
@ -110,12 +110,12 @@ TEST(HMACSHA1, Restart) {
class ForkDeathTest : public ::testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// shutdown NSS so it can be reinitialized after the fork
ceph::crypto::shutdown();
}
virtual void TearDown() {
void TearDown() override {
// undo the NSS shutdown we did in the parent process, after the
// test is done
ceph::crypto::init(g_ceph_context);

View File

@ -539,7 +539,7 @@ class ClsLua : public ::testing::Test {
ASSERT_EQ(0, destroy_one_pool_pp(pool_name, rados));
}
virtual void SetUp() {
void SetUp() override {
/* Grab test names to build unique objects */
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
@ -553,7 +553,7 @@ class ClsLua : public ::testing::Test {
oid = ss_oid.str();
}
virtual void TearDown() {
void TearDown() override {
}
/*

View File

@ -26,7 +26,7 @@ public:
list<pair<string, utime_t> > entries;
cls_replica_log_progress_marker progress;
void SetUp() {
void SetUp() override {
pool_name = get_temp_pool_name();
ASSERT_EQ("", create_one_pool_pp(pool_name, rados));
ASSERT_EQ(0, rados.ioctx_create(pool_name.c_str(), ioctx));

View File

@ -50,7 +50,7 @@ protected:
{
}
virtual void *entry() {
void *entry() override {
usleep(5);
waited = throttle.get(count);
throttle.put(count);

View File

@ -33,11 +33,11 @@ using ::testing::StrEq;
class DNSResolverTest : public ::testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
g_ceph_context->_conf->subsys.set_log_level(dout_subsys, TEST_DEBUG);
}
virtual void TearDown() {
void TearDown() override {
DNSResolver::get_instance(nullptr);
}
};

View File

@ -27,12 +27,12 @@ typedef boost::mt11213b gen_type;
class AsyncCompressorTest : public ::testing::Test {
public:
AsyncCompressor *async_compressor;
virtual void SetUp() {
void SetUp() override {
cerr << __func__ << " start set up " << std::endl;
async_compressor = new AsyncCompressor(g_ceph_context);
async_compressor->init();
}
virtual void TearDown() {
void TearDown() override {
async_compressor->terminate();
delete async_compressor;
}

View File

@ -19,13 +19,13 @@ protected:
enum { item_size = 100, };
vector<Item> items;
virtual void SetUp() {
void SetUp() override {
for (int i = 0; i < item_size; i++) {
items.push_back(Item(i));
}
std::random_shuffle(items.begin(), items.end());
}
virtual void TearDown() {
void TearDown() override {
items.clear();
}
};

View File

@ -53,7 +53,7 @@ public:
value(_value),
in_method(_in_method) { }
virtual void * entry() {
void * entry() override {
switch (in_method) {
case LOWER_BOUND:
ptr = cache.lower_bound(key);

View File

@ -53,7 +53,7 @@ public:
{
}
virtual void *entry() {
void *entry() override {
switch(in_method) {
case LOOKUP_OR_CREATE:
if (value)
@ -303,7 +303,7 @@ public:
int value;
};
virtual void SetUp() {
void SetUp() override {
died = UNDEFINED;
}
};

View File

@ -153,10 +153,10 @@ protected:
}
}
virtual void SetUp() {
void SetUp() override {
srand(time(0));
}
virtual void TearDown() {
void TearDown() override {
}
};

View File

@ -26,8 +26,8 @@ public:
explicit CompressorPluginExample(CephContext* cct) : CompressionPlugin(cct)
{}
virtual int factory(CompressorRef *cs,
ostream *ss)
int factory(CompressorRef *cs,
ostream *ss) override
{
if (compressor == 0) {
CompressorExample *interface = new CompressorExample();

View File

@ -56,11 +56,11 @@ public:
g_ceph_context->_conf->apply_changes(NULL);
}
void SetUp() {
void SetUp() override {
compressor = Compressor::create(g_ceph_context, plugin);
ASSERT_TRUE(compressor);
}
void TearDown() {
void TearDown() override {
compressor.reset();
}
};

View File

@ -11,7 +11,7 @@
class CryptoEnvironment: public ::testing::Environment {
public:
void SetUp() {
void SetUp() override {
ceph::crypto::init(g_ceph_context);
}
};

View File

@ -108,7 +108,7 @@ public:
delete m_object;
}
string decode(bufferlist bl, uint64_t seek) {
string decode(bufferlist bl, uint64_t seek) override {
bufferlist::iterator p = bl.begin();
p.seek(seek);
try {
@ -125,18 +125,18 @@ public:
return string();
}
virtual void encode(bufferlist& out, uint64_t features) = 0;
void encode(bufferlist& out, uint64_t features) override = 0;
void dump(ceph::Formatter *f) {
void dump(ceph::Formatter *f) override {
m_object->dump(f);
}
void generate() {
void generate() override {
T::generate_test_instances(m_list);
}
int num_generated() {
int num_generated() override {
return m_list.size();
}
string select_generated(unsigned i) {
string select_generated(unsigned i) override {
// allow 0- or 1-based (by wrapping)
if (i == 0)
i = m_list.size();
@ -148,7 +148,7 @@ public:
return string();
}
bool is_deterministic() {
bool is_deterministic() override {
return !nondeterministic;
}
};
@ -158,7 +158,7 @@ class DencoderImplNoFeatureNoCopy : public DencoderBase<T> {
public:
DencoderImplNoFeatureNoCopy(bool stray_ok, bool nondeterministic)
: DencoderBase<T>(stray_ok, nondeterministic) {}
virtual void encode(bufferlist& out, uint64_t features) {
void encode(bufferlist& out, uint64_t features) override {
out.clear();
::encode(*this->m_object, out);
}
@ -169,13 +169,13 @@ class DencoderImplNoFeature : public DencoderImplNoFeatureNoCopy<T> {
public:
DencoderImplNoFeature(bool stray_ok, bool nondeterministic)
: DencoderImplNoFeatureNoCopy<T>(stray_ok, nondeterministic) {}
void copy() {
void copy() override {
T *n = new T;
*n = *this->m_object;
delete this->m_object;
this->m_object = n;
}
void copy_ctor() {
void copy_ctor() override {
T *n = new T(*this->m_object);
delete this->m_object;
this->m_object = n;
@ -187,7 +187,7 @@ class DencoderImplFeaturefulNoCopy : public DencoderBase<T> {
public:
DencoderImplFeaturefulNoCopy(bool stray_ok, bool nondeterministic)
: DencoderBase<T>(stray_ok, nondeterministic) {}
virtual void encode(bufferlist& out, uint64_t features) {
void encode(bufferlist& out, uint64_t features) override {
out.clear();
::encode(*(this->m_object), out, features);
}
@ -198,13 +198,13 @@ class DencoderImplFeatureful : public DencoderImplFeaturefulNoCopy<T> {
public:
DencoderImplFeatureful(bool stray_ok, bool nondeterministic)
: DencoderImplFeaturefulNoCopy<T>(stray_ok, nondeterministic) {}
void copy() {
void copy() override {
T *n = new T;
*n = *this->m_object;
delete this->m_object;
this->m_object = n;
}
void copy_ctor() {
void copy_ctor() override {
T *n = new T(*this->m_object);
delete this->m_object;
this->m_object = n;
@ -224,7 +224,7 @@ public:
m_object->put();
}
string decode(bufferlist bl, uint64_t seek) {
string decode(bufferlist bl, uint64_t seek) override {
bufferlist::iterator p = bl.begin();
p.seek(seek);
try {
@ -250,21 +250,21 @@ public:
return string();
}
void encode(bufferlist& out, uint64_t features) {
void encode(bufferlist& out, uint64_t features) override {
out.clear();
encode_message(m_object, features, out);
}
void dump(ceph::Formatter *f) {
void dump(ceph::Formatter *f) override {
m_object->dump(f);
}
void generate() {
void generate() override {
//T::generate_test_instances(m_list);
}
int num_generated() {
int num_generated() override {
return m_list.size();
}
string select_generated(unsigned i) {
string select_generated(unsigned i) override {
// allow 0- or 1-based (by wrapping)
if (i == 0)
i = m_list.size();
@ -276,7 +276,7 @@ public:
m_object = *p;
return string();
}
bool is_deterministic() {
bool is_deterministic() override {
return true;
}

View File

@ -23,10 +23,10 @@
class ErasureCodePluginExample : public ErasureCodePlugin {
public:
virtual int factory(const std::string &directory,
int factory(const std::string &directory,
ErasureCodeProfile &profile,
ErasureCodeInterfaceRef *erasure_code,
ostream *ss)
ostream *ss) override
{
*erasure_code = ErasureCodeInterfaceRef(new ErasureCodeExample());
(*erasure_code)->init(profile, ss);

View File

@ -31,25 +31,25 @@ public:
ErasureCodeTest(unsigned int _k, unsigned int _m, unsigned int _chunk_size) :
k(_k), m(_m), chunk_size(_chunk_size) {}
virtual ~ErasureCodeTest() {}
~ErasureCodeTest() {}
virtual int init(ErasureCodeProfile &profile, ostream *ss) {
int init(ErasureCodeProfile &profile, ostream *ss) override {
return 0;
}
virtual unsigned int get_chunk_count() const { return k + m; }
virtual unsigned int get_data_chunk_count() const { return k; }
virtual unsigned int get_chunk_size(unsigned int object_size) const {
unsigned int get_chunk_count() const override { return k + m; }
unsigned int get_data_chunk_count() const override { return k; }
unsigned int get_chunk_size(unsigned int object_size) const override {
return chunk_size;
}
virtual int encode_chunks(const set<int> &want_to_encode,
map<int, bufferlist> *encoded) {
int encode_chunks(const set<int> &want_to_encode,
map<int, bufferlist> *encoded) override {
encode_chunks_encoded = *encoded;
return 0;
}
virtual int create_ruleset(const string &name,
int create_ruleset(const string &name,
CrushWrapper &crush,
ostream *ss) const { return 0; }
ostream *ss) const override { return 0; }
};

View File

@ -36,7 +36,7 @@ protected:
instance.lock.Unlock();
}
virtual void *entry() {
void *entry() override {
ErasureCodeProfile profile;
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
ErasureCodeInterfaceRef erasure_code;

View File

@ -20,7 +20,7 @@ public:
int *result;
C_Checker(bool* _finish_called, int *r) :
finish_called(_finish_called), result(r) {}
void finish(int r) { *finish_called = true; *result = r; }
void finish(int r) override { *finish_called = true; *result = r; }
};
TEST(ContextGather, Constructor) {

View File

@ -13,14 +13,14 @@ public:
uint64_t refs;
uint64_t flushes;
FlushHandler() : refs(0), flushes(0) {}
virtual void get() {
void get() override {
++refs;
}
virtual void put() {
void put() override {
assert(refs > 0);
--refs;
}
virtual void flush(const journal::FutureImplPtr &future) {
void flush(const journal::FutureImplPtr &future) override {
++flushes;
}
};

View File

@ -9,7 +9,7 @@
class TestJournalMetadata : public RadosTestFixture {
public:
virtual void TearDown() {
void TearDown() override {
for (MetadataList::iterator it = m_metadata_list.begin();
it != m_metadata_list.end(); ++it) {
(*it)->remove_listener(&m_listener);

View File

@ -33,16 +33,16 @@ public:
: lock("lock"), entries_available(false), complete(false),
complete_result(0) {}
virtual void get() {}
virtual void put() {}
void get() override {}
void put() override {}
virtual void handle_entries_available() {
void handle_entries_available() override {
Mutex::Locker locker(lock);
entries_available = true;
cond.Signal();
}
virtual void handle_complete(int r) {
void handle_complete(int r) override {
Mutex::Locker locker(lock);
complete = true;
complete_result = r;
@ -50,7 +50,7 @@ public:
}
};
virtual void TearDown() {
void TearDown() override {
for (JournalPlayers::iterator it = m_players.begin();
it != m_players.end(); ++it) {
delete *it;

View File

@ -11,7 +11,7 @@
class TestJournalRecorder : public RadosTestFixture {
public:
virtual void TearDown() {
void TearDown() override {
for (std::list<journal::JournalRecorder*>::iterator it = m_recorders.begin();
it != m_recorders.end(); ++it) {
delete *it;

View File

@ -11,7 +11,7 @@
class TestJournalTrimmer : public RadosTestFixture {
public:
virtual void TearDown() {
void TearDown() override {
for (MetadataList::iterator it = m_metadata_list.begin();
it != m_metadata_list.end(); ++it) {
(*it)->remove_listener(&m_listener);

View File

@ -18,14 +18,14 @@ public:
return stringify(++_journal_id);
}
virtual void SetUp() {
void SetUp() override {
RadosTestFixture::SetUp();
m_journal_id = get_temp_journal_id();
m_journaler = new journal::Journaler(m_work_queue, m_timer, &m_timer_lock,
m_ioctx, m_journal_id, CLIENT_ID, {});
}
virtual void TearDown() {
void TearDown() override {
delete m_journaler;
RadosTestFixture::TearDown();
}

View File

@ -31,12 +31,12 @@ public:
Handler() : lock("lock") {
}
virtual void closed(journal::ObjectRecorder *object_recorder) {
void closed(journal::ObjectRecorder *object_recorder) override {
Mutex::Locker locker(lock);
is_closed = true;
cond.Signal();
}
virtual void overflow(journal::ObjectRecorder *object_recorder) {
void overflow(journal::ObjectRecorder *object_recorder) override {
Mutex::Locker locker(lock);
journal::AppendBuffers append_buffers;
object_lock->Lock();
@ -59,7 +59,7 @@ public:
double m_flush_age;
Handler m_handler;
void TearDown() {
void TearDown() override {
for (ObjectRecorders::iterator it = m_object_recorders.begin();
it != m_object_recorders.end(); ++it) {
C_SaferCond cond;

View File

@ -38,8 +38,8 @@ class MessengerClient {
public:
ClientDispatcher(uint64_t delay, ClientThread *t): Dispatcher(g_ceph_context), think_time(delay), thread(t) {}
bool ms_can_fast_dispatch_any() const { return true; }
bool ms_can_fast_dispatch(Message *m) const {
bool ms_can_fast_dispatch_any() const override { return true; }
bool ms_can_fast_dispatch(Message *m) const override {
switch (m->get_type()) {
case CEPH_MSG_OSD_OPREPLY:
return true;
@ -48,16 +48,16 @@ class MessengerClient {
}
}
void ms_handle_fast_connect(Connection *con) {}
void ms_handle_fast_accept(Connection *con) {}
bool ms_dispatch(Message *m) { return true; }
void ms_fast_dispatch(Message *m);
bool ms_handle_reset(Connection *con) { return true; }
void ms_handle_remote_reset(Connection *con) {}
bool ms_handle_refused(Connection *con) { return false; }
void ms_handle_fast_connect(Connection *con) override {}
void ms_handle_fast_accept(Connection *con) override {}
bool ms_dispatch(Message *m) override { return true; }
void ms_fast_dispatch(Message *m) override;
bool ms_handle_reset(Connection *con) override { return true; }
void ms_handle_remote_reset(Connection *con) override {}
bool ms_handle_refused(Connection *con) override { return false; }
bool ms_verify_authorizer(Connection *con, int peer_type, int protocol,
bufferlist& authorizer, bufferlist& authorizer_reply,
bool& isvalid, CryptoKey& session_key) {
bool& isvalid, CryptoKey& session_key) override {
isvalid = true;
return true;
}
@ -89,7 +89,7 @@ class MessengerClient {
memset(ptr.c_str(), 0, msg_len);
data.append(ptr);
}
void *entry() {
void *entry() override {
lock.Lock();
for (int i = 0; i < ops; ++i) {
if (inflight > uint64_t(concurrent)) {

View File

@ -40,17 +40,17 @@ class ServerDispatcher : public Dispatcher {
OpWQ(time_t timeout, time_t suicide_timeout, ThreadPool *tp)
: ThreadPool::WorkQueue<Message>("ServerDispatcher::OpWQ", timeout, suicide_timeout, tp) {}
bool _enqueue(Message *m) {
bool _enqueue(Message *m) override {
messages.push_back(m);
return true;
}
void _dequeue(Message *m) {
void _dequeue(Message *m) override {
ceph_abort();
}
bool _empty() {
bool _empty() override {
return messages.empty();
}
Message *_dequeue() {
Message *_dequeue() override {
if (messages.empty())
return NULL;
Message *m = messages.front();
@ -63,8 +63,8 @@ class ServerDispatcher : public Dispatcher {
m->get_connection()->send_message(reply);
m->put();
}
void _process_finish(Message *m) { }
void _clear() {
void _process_finish(Message *m) override { }
void _clear() override {
assert(messages.empty());
}
} op_wq;
@ -78,8 +78,8 @@ class ServerDispatcher : public Dispatcher {
~ServerDispatcher() {
op_tp.stop();
}
bool ms_can_fast_dispatch_any() const { return true; }
bool ms_can_fast_dispatch(Message *m) const {
bool ms_can_fast_dispatch_any() const override { return true; }
bool ms_can_fast_dispatch(Message *m) const override {
switch (m->get_type()) {
case CEPH_MSG_OSD_OP:
return true;
@ -88,20 +88,20 @@ class ServerDispatcher : public Dispatcher {
}
}
void ms_handle_fast_connect(Connection *con) {}
void ms_handle_fast_accept(Connection *con) {}
bool ms_dispatch(Message *m) { return true; }
bool ms_handle_reset(Connection *con) { return true; }
void ms_handle_remote_reset(Connection *con) {}
bool ms_handle_refused(Connection *con) { return false; }
void ms_fast_dispatch(Message *m) {
void ms_handle_fast_connect(Connection *con) override {}
void ms_handle_fast_accept(Connection *con) override {}
bool ms_dispatch(Message *m) override { return true; }
bool ms_handle_reset(Connection *con) override { return true; }
void ms_handle_remote_reset(Connection *con) override {}
bool ms_handle_refused(Connection *con) override { return false; }
void ms_fast_dispatch(Message *m) override {
usleep(think_time);
//cerr << __func__ << " reply message=" << m << std::endl;
op_wq.queue(m);
}
bool ms_verify_authorizer(Connection *con, int peer_type, int protocol,
bufferlist& authorizer, bufferlist& authorizer_reply,
bool& isvalid, CryptoKey& session_key) {
bool& isvalid, CryptoKey& session_key) override {
isvalid = true;
return true;
}

View File

@ -65,7 +65,7 @@ class EventDriverTest : public ::testing::TestWithParam<const char*> {
EventDriver *driver;
EventDriverTest(): driver(0) {}
virtual void SetUp() {
void SetUp() override {
cerr << __func__ << " start set up " << GetParam() << std::endl;
#ifdef HAVE_EPOLL
if (strcmp(GetParam(), "epoll"))
@ -79,7 +79,7 @@ class EventDriverTest : public ::testing::TestWithParam<const char*> {
driver = new SelectDriver(g_ceph_context);
driver->init(NULL, 100);
}
virtual void TearDown() {
void TearDown() override {
delete driver;
}
};
@ -250,7 +250,7 @@ TEST_P(EventDriverTest, NetworkSocketTest) {
class FakeEvent : public EventCallback {
public:
void do_request(int fd_or_id) {}
void do_request(int fd_or_id) override {}
};
TEST(EventCenterTest, FileEventExpansion) {
@ -283,7 +283,7 @@ class Worker : public Thread {
done = true;
center.wakeup();
}
void* entry() {
void* entry() override {
center.set_owner();
while (!done)
center.process_events(1000000);
@ -298,7 +298,7 @@ class CountEvent: public EventCallback {
public:
CountEvent(atomic_t *atomic, Mutex *l, Cond *c): count(atomic), lock(l), cond(c) {}
void do_request(int id) {
void do_request(int id) override {
lock->Lock();
count->dec();
cond->Signal();

View File

@ -38,7 +38,7 @@ class NetworkWorkerTest : public ::testing::TestWithParam<const char*> {
string addr, port_addr;
NetworkWorkerTest() {}
virtual void SetUp() {
void SetUp() override {
cerr << __func__ << " start set up " << GetParam() << std::endl;
if (strncmp(GetParam(), "dpdk", 4)) {
g_ceph_context->_conf->set_val("ms_type", "async+posix", false, false);
@ -58,7 +58,7 @@ class NetworkWorkerTest : public ::testing::TestWithParam<const char*> {
stack = NetworkStack::create(g_ceph_context, GetParam());
stack->start();
}
virtual void TearDown() {
void TearDown() override {
stack->stop();
}
string get_addr() const {
@ -83,7 +83,7 @@ class NetworkWorkerTest : public ::testing::TestWithParam<const char*> {
std::atomic_bool done;
public:
C_dispatch(Worker *w, func &&_f): worker(w), f(std::move(_f)), done(false) {}
void do_request(int id) {
void do_request(int id) override {
f(worker);
done = true;
}
@ -120,7 +120,7 @@ class C_poll : public EventCallback {
public:
C_poll(EventCenter *c): center(c), woken(false) {}
void do_request(int r) {
void do_request(int r) override {
woken = true;
}
bool poll(int milliseconds) {
@ -626,7 +626,7 @@ class StressFactory {
T *ctxt;
public:
C_delete(T *c): ctxt(c) {}
void do_request(int id) {
void do_request(int id) override {
delete ctxt;
delete this;
}
@ -651,7 +651,7 @@ class StressFactory {
Client *c;
public:
Client_read_handle(Client *_c): c(_c) {}
void do_request(int id) {
void do_request(int id) override {
c->do_read_request();
}
} read_ctxt;
@ -660,7 +660,7 @@ class StressFactory {
Client *c;
public:
Client_write_handle(Client *_c): c(_c) {}
void do_request(int id) {
void do_request(int id) override {
c->do_write_request();
}
} write_ctxt;
@ -790,7 +790,7 @@ class StressFactory {
Server *s;
public:
Server_read_handle(Server *_s): s(_s) {}
void do_request(int id) {
void do_request(int id) override {
s->do_read_request();
}
} read_ctxt;
@ -799,7 +799,7 @@ class StressFactory {
Server *s;
public:
Server_write_handle(Server *_s): s(_s) {}
void do_request(int id) {
void do_request(int id) override {
s->do_write_request();
}
} write_ctxt;
@ -903,7 +903,7 @@ class StressFactory {
public:
C_accept(StressFactory *f, ServerSocket s, ThreadData *data, Worker *w)
: factory(f), bind_socket(std::move(s)), t_data(data), worker(w) {}
void do_request(int id) {
void do_request(int id) override {
while (true) {
entity_addr_t cli_addr;
ConnectedSocket srv_socket;

View File

@ -63,14 +63,14 @@ class MessengerTest : public ::testing::TestWithParam<const char*> {
Messenger *client_msgr;
MessengerTest(): server_msgr(NULL), client_msgr(NULL) {}
virtual void SetUp() {
void SetUp() override {
lderr(g_ceph_context) << __func__ << " start set up " << GetParam() << dendl;
server_msgr = Messenger::create(g_ceph_context, string(GetParam()), entity_name_t::OSD(0), "server", getpid(), 0);
client_msgr = Messenger::create(g_ceph_context, string(GetParam()), entity_name_t::CLIENT(-1), "client", getpid(), 0);
server_msgr->set_default_policy(Messenger::Policy::stateless_server(0, 0));
client_msgr->set_default_policy(Messenger::Policy::lossy_client(0, 0));
}
virtual void TearDown() {
void TearDown() override {
ASSERT_EQ(server_msgr->get_dispatch_queue_len(), 0);
ASSERT_EQ(client_msgr->get_dispatch_queue_len(), 0);
delete server_msgr;
@ -102,8 +102,8 @@ class FakeDispatcher : public Dispatcher {
explicit FakeDispatcher(bool s): Dispatcher(g_ceph_context), lock("FakeDispatcher::lock"),
is_server(s), got_new(false), got_remote_reset(false),
got_connect(false), loopback(false) {}
bool ms_can_fast_dispatch_any() const { return true; }
bool ms_can_fast_dispatch(Message *m) const {
bool ms_can_fast_dispatch_any() const override { return true; }
bool ms_can_fast_dispatch(Message *m) const override {
switch (m->get_type()) {
case CEPH_MSG_PING:
return true;
@ -112,7 +112,7 @@ class FakeDispatcher : public Dispatcher {
}
}
void ms_handle_fast_connect(Connection *con) {
void ms_handle_fast_connect(Connection *con) override {
lock.Lock();
lderr(g_ceph_context) << __func__ << " " << con << dendl;
Session *s = static_cast<Session*>(con->get_priv());
@ -126,7 +126,7 @@ class FakeDispatcher : public Dispatcher {
cond.Signal();
lock.Unlock();
}
void ms_handle_fast_accept(Connection *con) {
void ms_handle_fast_accept(Connection *con) override {
Session *s = static_cast<Session*>(con->get_priv());
if (!s) {
s = new Session(con);
@ -134,7 +134,7 @@ class FakeDispatcher : public Dispatcher {
}
s->put();
}
bool ms_dispatch(Message *m) {
bool ms_dispatch(Message *m) override {
Session *s = static_cast<Session*>(m->get_connection()->get_priv());
if (!s) {
s = new Session(m->get_connection());
@ -152,7 +152,7 @@ class FakeDispatcher : public Dispatcher {
m->put();
return true;
}
bool ms_handle_reset(Connection *con) {
bool ms_handle_reset(Connection *con) override {
Mutex::Locker l(lock);
lderr(g_ceph_context) << __func__ << " " << con << dendl;
Session *s = static_cast<Session*>(con->get_priv());
@ -163,7 +163,7 @@ class FakeDispatcher : public Dispatcher {
}
return true;
}
void ms_handle_remote_reset(Connection *con) {
void ms_handle_remote_reset(Connection *con) override {
Mutex::Locker l(lock);
lderr(g_ceph_context) << __func__ << " " << con << dendl;
Session *s = static_cast<Session*>(con->get_priv());
@ -175,10 +175,10 @@ class FakeDispatcher : public Dispatcher {
got_remote_reset = true;
cond.Signal();
}
bool ms_handle_refused(Connection *con) {
bool ms_handle_refused(Connection *con) override {
return false;
}
void ms_fast_dispatch(Message *m) {
void ms_fast_dispatch(Message *m) override {
Session *s = static_cast<Session*>(m->get_connection()->get_priv());
if (!s) {
s = new Session(m->get_connection());
@ -203,7 +203,7 @@ class FakeDispatcher : public Dispatcher {
bool ms_verify_authorizer(Connection *con, int peer_type, int protocol,
bufferlist& authorizer, bufferlist& authorizer_reply,
bool& isvalid, CryptoKey& session_key) {
bool& isvalid, CryptoKey& session_key) override {
isvalid = true;
return true;
}
@ -813,8 +813,8 @@ class SyntheticDispatcher : public Dispatcher {
SyntheticDispatcher(bool s, SyntheticWorkload *wl):
Dispatcher(g_ceph_context), lock("SyntheticDispatcher::lock"), is_server(s), got_new(false),
got_remote_reset(false), got_connect(false), index(0), workload(wl) {}
bool ms_can_fast_dispatch_any() const { return true; }
bool ms_can_fast_dispatch(Message *m) const {
bool ms_can_fast_dispatch_any() const override { return true; }
bool ms_can_fast_dispatch(Message *m) const override {
switch (m->get_type()) {
case CEPH_MSG_PING:
case MSG_COMMAND:
@ -824,7 +824,7 @@ class SyntheticDispatcher : public Dispatcher {
}
}
void ms_handle_fast_connect(Connection *con) {
void ms_handle_fast_connect(Connection *con) override {
Mutex::Locker l(lock);
list<uint64_t> c = conn_sent[con];
for (list<uint64_t>::iterator it = c.begin();
@ -834,7 +834,7 @@ class SyntheticDispatcher : public Dispatcher {
got_connect = true;
cond.Signal();
}
void ms_handle_fast_accept(Connection *con) {
void ms_handle_fast_accept(Connection *con) override {
Mutex::Locker l(lock);
list<uint64_t> c = conn_sent[con];
for (list<uint64_t>::iterator it = c.begin();
@ -843,11 +843,11 @@ class SyntheticDispatcher : public Dispatcher {
conn_sent.erase(con);
cond.Signal();
}
bool ms_dispatch(Message *m) {
bool ms_dispatch(Message *m) override {
ceph_abort();
}
bool ms_handle_reset(Connection *con);
void ms_handle_remote_reset(Connection *con) {
bool ms_handle_reset(Connection *con) override;
void ms_handle_remote_reset(Connection *con) override {
Mutex::Locker l(lock);
list<uint64_t> c = conn_sent[con];
for (list<uint64_t>::iterator it = c.begin();
@ -856,10 +856,10 @@ class SyntheticDispatcher : public Dispatcher {
conn_sent.erase(con);
got_remote_reset = true;
}
bool ms_handle_refused(Connection *con) {
bool ms_handle_refused(Connection *con) override {
return false;
}
void ms_fast_dispatch(Message *m) {
void ms_fast_dispatch(Message *m) override {
// MSG_COMMAND is used to disorganize regular message flow
if (m->get_type() == MSG_COMMAND) {
m->put();
@ -893,7 +893,7 @@ class SyntheticDispatcher : public Dispatcher {
bool ms_verify_authorizer(Connection *con, int peer_type, int protocol,
bufferlist& authorizer, bufferlist& authorizer_reply,
bool& isvalid, CryptoKey& session_key) {
bool& isvalid, CryptoKey& session_key) override {
isvalid = true;
return true;
}
@ -1373,8 +1373,8 @@ class MarkdownDispatcher : public Dispatcher {
atomic_t count;
explicit MarkdownDispatcher(bool s): Dispatcher(g_ceph_context), lock("MarkdownDispatcher::lock"),
last_mark(false), count(0) {}
bool ms_can_fast_dispatch_any() const { return false; }
bool ms_can_fast_dispatch(Message *m) const {
bool ms_can_fast_dispatch_any() const override { return false; }
bool ms_can_fast_dispatch(Message *m) const override {
switch (m->get_type()) {
case CEPH_MSG_PING:
return true;
@ -1383,16 +1383,16 @@ class MarkdownDispatcher : public Dispatcher {
}
}
void ms_handle_fast_connect(Connection *con) {
void ms_handle_fast_connect(Connection *con) override {
lderr(g_ceph_context) << __func__ << " " << con << dendl;
Mutex::Locker l(lock);
conns.insert(con);
}
void ms_handle_fast_accept(Connection *con) {
void ms_handle_fast_accept(Connection *con) override {
Mutex::Locker l(lock);
conns.insert(con);
}
bool ms_dispatch(Message *m) {
bool ms_dispatch(Message *m) override {
lderr(g_ceph_context) << __func__ << " conn: " << m->get_connection() << dendl;
Mutex::Locker l(lock);
count.inc();
@ -1416,27 +1416,27 @@ class MarkdownDispatcher : public Dispatcher {
m->put();
return true;
}
bool ms_handle_reset(Connection *con) {
bool ms_handle_reset(Connection *con) override {
lderr(g_ceph_context) << __func__ << " " << con << dendl;
Mutex::Locker l(lock);
conns.erase(con);
usleep(rand() % 500);
return true;
}
void ms_handle_remote_reset(Connection *con) {
void ms_handle_remote_reset(Connection *con) override {
Mutex::Locker l(lock);
conns.erase(con);
lderr(g_ceph_context) << __func__ << " " << con << dendl;
}
bool ms_handle_refused(Connection *con) {
bool ms_handle_refused(Connection *con) override {
return false;
}
void ms_fast_dispatch(Message *m) {
void ms_fast_dispatch(Message *m) override {
ceph_abort();
}
bool ms_verify_authorizer(Connection *con, int peer_type, int protocol,
bufferlist& authorizer, bufferlist& authorizer_reply,
bool& isvalid, CryptoKey& session_key) {
bool& isvalid, CryptoKey& session_key) override {
isvalid = true;
return true;
}

View File

@ -22,7 +22,7 @@ static sem_t sem;
class WatchNotifyTestCtx : public WatchCtx
{
public:
void notify(uint8_t opcode, uint64_t ver, bufferlist& bl)
void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override
{
sem_post(&sem);
}

View File

@ -87,7 +87,7 @@ class C_NotifyCond : public Context {
public:
C_NotifyCond(std::mutex *mutex, std::condition_variable *cond, bool *done)
: mutex(mutex), cond(cond), done(done) {}
void finish(int r) {
void finish(int r) override {
std::lock_guard<std::mutex> lock(*mutex);
*done = true;
cond->notify_one();

View File

@ -330,7 +330,7 @@ class CondPingPong {
CondPingPong *p;
public:
explicit Consumer(CondPingPong *p): p(p) {}
void* entry() {
void* entry() override {
p->consume();
return 0;
}
@ -473,7 +473,7 @@ class CenterWorker : public Thread {
done = true;
center.wakeup();
}
void* entry() {
void* entry() override {
center.set_owner();
bind_thread_to_cpu(2);
while (!done)
@ -487,7 +487,7 @@ class CountEvent: public EventCallback {
public:
explicit CountEvent(atomic_t *atomic): count(atomic) {}
void do_request(int id) {
void do_request(int id) override {
count->dec();
}
};
@ -749,7 +749,7 @@ double test_spinlock()
// Helper for spawn_thread. This is the main function that the thread executes
// (intentionally empty).
class ThreadHelper : public Thread {
void *entry() { return 0; }
void *entry() override { return 0; }
};
// Measure the cost of start and joining with a thread.
@ -768,7 +768,7 @@ double spawn_thread()
class FakeContext : public Context {
public:
virtual void finish(int r) {}
void finish(int r) override {}
};
// Measure the cost of starting and stopping a Dispatch::Timer.

View File

@ -56,7 +56,7 @@ public:
{
}
int run(void)
int run(void) override
{
int ret_val = 0;
rados_t cl;
@ -141,7 +141,7 @@ public:
{
}
int run(void)
int run(void) override
{
int ret_val = 0;
rados_t cl;
@ -223,7 +223,7 @@ int main(int argc, const char **argv)
const char *num_objects = getenv("NUM_OBJECTS");
const std::string pool = get_temp_pool_name(argv[0]);
if (num_objects) {
g_num_objects = atoi(num_objects);
g_num_objects = atoi(num_objects);
if (g_num_objects == 0)
return 100;
}
@ -343,6 +343,6 @@ int main(int argc, const char **argv)
rados_connect(cl);
rados_pool_delete(cl, pool.c_str());
printf("******* SUCCESS **********\n");
printf("******* SUCCESS **********\n");
return EXIT_SUCCESS;
}

View File

@ -63,7 +63,7 @@ public:
{
}
int run()
int run() override
{
rados_t cl;
RETURN1_IF_NONZERO(rados_create(&cl, NULL));

View File

@ -44,7 +44,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver<string, bufferlist> {
struct Remove : public _Op {
set<string> to_remove;
explicit Remove(const set<string> &to_remove) : to_remove(to_remove) {}
void operate(map<string, bufferlist> *store) {
void operate(map<string, bufferlist> *store) override {
for (set<string>::iterator i = to_remove.begin();
i != to_remove.end();
++i) {
@ -55,7 +55,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver<string, bufferlist> {
struct Insert : public _Op {
map<string, bufferlist> to_insert;
explicit Insert(const map<string, bufferlist> &to_insert) : to_insert(to_insert) {}
void operate(map<string, bufferlist> *store) {
void operate(map<string, bufferlist> *store) override {
for (map<string, bufferlist>::iterator i = to_insert.begin();
i != to_insert.end();
++i) {
@ -67,7 +67,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver<string, bufferlist> {
struct Callback : public _Op {
Context *context;
explicit Callback(Context *c) : context(c) {}
void operate(map<string, bufferlist> *store) {
void operate(map<string, bufferlist> *store) override {
context->complete(0);
}
};
@ -77,13 +77,13 @@ public:
list<Op> ops;
list<Op> callbacks;
public:
void set_keys(const map<string, bufferlist> &i) {
void set_keys(const map<string, bufferlist> &i) override {
ops.push_back(Op(new Insert(i)));
}
void remove_keys(const set<string> &r) {
void remove_keys(const set<string> &r) override {
ops.push_back(Op(new Remove(r)));
}
void add_callback(Context *c) {
void add_callback(Context *c) override {
callbacks.push_back(Op(new Callback(c)));
}
};
@ -103,7 +103,7 @@ private:
public:
explicit Doer(PausyAsyncMap *parent) :
parent(parent), lock("Doer lock"), stopping(0), paused(false) {}
virtual void *entry() {
void *entry() override {
while (1) {
list<Op> ops;
{
@ -172,7 +172,7 @@ public:
}
int get_keys(
const set<string> &keys,
map<string, bufferlist> *out) {
map<string, bufferlist> *out) override {
Mutex::Locker l(lock);
for (set<string>::const_iterator i = keys.begin();
i != keys.end();
@ -185,7 +185,7 @@ public:
}
int get_next(
const string &key,
pair<string, bufferlist> *next) {
pair<string, bufferlist> *next) override {
Mutex::Locker l(lock);
map<string, bufferlist>::iterator j = store.upper_bound(key);
if (j != store.end()) {
@ -213,7 +213,7 @@ public:
public:
OnFinish(Mutex *lock, Cond *cond, bool *done)
: lock(lock), cond(cond), done(done) {}
void finish(int) {
void finish(int) override {
Mutex::Locker l(*lock);
*done = true;
cond->Signal();
@ -364,7 +364,7 @@ public:
cur = next.first;
}
}
virtual void SetUp() {
void SetUp() override {
driver.reset(new PausyAsyncMap());
cache.reset(new MapCacher::MapCacher<string, bufferlist>(driver.get()));
names.clear();
@ -374,7 +374,7 @@ public:
names.insert(random_string(1 + (random_size() % 10)));
}
}
virtual void TearDown() {
void TearDown() override {
driver->stop();
cache.reset();
driver.reset();
@ -587,12 +587,12 @@ protected:
map<pg_t, ceph::shared_ptr<MapperVerifier> > mappers;
uint32_t pgnum;
virtual void SetUp() {
void SetUp() override {
driver.reset(new PausyAsyncMap());
pgnum = 0;
}
virtual void TearDown() {
void TearDown() override {
driver->stop();
mappers.clear();
driver.reset();

View File

@ -28,7 +28,7 @@ static atomic_t stop_flag;
class WatchNotifyTestCtx : public WatchCtx
{
public:
void notify(uint8_t opcode, uint64_t ver, bufferlist& bl)
void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override
{
sem_post(sem);
}
@ -42,7 +42,7 @@ struct WatcherUnwatcher : public Thread {
string pool;
explicit WatcherUnwatcher(string& _pool) : pool(_pool) {}
void *entry() {
void *entry() override {
Rados cluster;
connect_cluster_pp(cluster);
while (!stop_flag.read()) {

View File

@ -25,7 +25,7 @@
#define dout_prefix *_dout
struct Foo : public Thread {
void *entry() {
void *entry() override {
dout(0) << "foo started" << dendl;
sleep(1);
dout(0) << "foo asserting 0" << dendl;

View File

@ -26,13 +26,13 @@ protected:
// for filling up an ItemList
Refs refs;
virtual void SetUp() {
void SetUp() override {
for (int i = 0; i < 13; i++) {
items.push_back(new Item(i));
refs.push_back(&items.back()->xitem);
}
}
virtual void TearDown() {
void TearDown() override {
for (Items::iterator i = items.begin(); i != items.end(); ++i) {
delete *i;
}

View File

@ -66,7 +66,7 @@ public:
(*in_progress)++;
}
void finish(int r) {
void finish(int r) override {
Mutex::Locker l(*lock);
(*in_progress)--;
cond->Signal();

View File

@ -265,7 +265,7 @@ struct lookup_ghobject : public action_on_object_t {
lookup_ghobject(const string& name, const boost::optional<std::string>& nspace, bool need_snapset = false) : _name(name),
_namespace(nspace), _need_snapset(need_snapset) { }
virtual int call(ObjectStore *store, coll_t coll, ghobject_t &ghobj, object_info_t &oi) {
int call(ObjectStore *store, coll_t coll, ghobject_t &ghobj, object_info_t &oi) override {
if (_need_snapset && !ghobj.hobj.has_snapset())
return 0;
if ((_name.length() == 0 || ghobj.hobj.oid.name == _name) &&
@ -1828,8 +1828,8 @@ struct do_fix_lost : public action_on_object_t {
explicit do_fix_lost(ObjectStore::Sequencer *_osr) : osr(_osr) {}
virtual int call(ObjectStore *store, coll_t coll,
ghobject_t &ghobj, object_info_t &oi) {
int call(ObjectStore *store, coll_t coll,
ghobject_t &ghobj, object_info_t &oi) override {
if (oi.is_lost()) {
cout << coll << "/" << ghobj << " is lost";
if (!dry_run)

View File

@ -493,11 +493,11 @@ class RadosWatchCtx : public librados::WatchCtx2 {
string name;
public:
RadosWatchCtx(IoCtx& io, const char *imgname) : ioctx(io), name(imgname) {}
virtual ~RadosWatchCtx() {}
~RadosWatchCtx() {}
void handle_notify(uint64_t notify_id,
uint64_t cookie,
uint64_t notifier_id,
bufferlist& bl) {
bufferlist& bl) override {
cout << "NOTIFY"
<< " cookie " << cookie
<< " notify_id " << notify_id
@ -506,7 +506,7 @@ public:
bl.hexdump(cout);
ioctx.notify_ack(name, notify_id, cookie, bl);
}
void handle_error(uint64_t cookie, int err) {
void handle_error(uint64_t cookie, int err) override {
cout << "ERROR"
<< " cookie " << cookie
<< " err " << cpp_strerror(err)
@ -886,15 +886,15 @@ class RadosBencher : public ObjBencher {
OpWriteDest write_destination;
protected:
int completions_init(int concurrentios) {
int completions_init(int concurrentios) override {
completions = new librados::AioCompletion *[concurrentios];
return 0;
}
void completions_done() {
void completions_done() override {
delete[] completions;
completions = NULL;
}
int create_completion(int slot, void (*cb)(void *, void*), void *arg) {
int create_completion(int slot, void (*cb)(void *, void*), void *arg) override {
completions[slot] = rados.aio_create_completion((void *) arg, 0, cb);
if (!completions[slot])
@ -902,18 +902,18 @@ protected:
return 0;
}
void release_completion(int slot) {
void release_completion(int slot) override {
completions[slot]->release();
completions[slot] = 0;
}
int aio_read(const std::string& oid, int slot, bufferlist *pbl, size_t len,
size_t offset) {
size_t offset) override {
return io_ctx.aio_read(oid, completions[slot], pbl, len, 0);
}
int aio_write(const std::string& oid, int slot, bufferlist& bl, size_t len,
size_t offset) {
size_t offset) override {
librados::ObjectWriteOperation op;
if (write_destination & OP_WRITE_DEST_OBJ) {
@ -941,33 +941,33 @@ protected:
return io_ctx.aio_operate(oid, completions[slot], &op);
}
int aio_remove(const std::string& oid, int slot) {
int aio_remove(const std::string& oid, int slot) override {
return io_ctx.aio_remove(oid, completions[slot]);
}
int sync_read(const std::string& oid, bufferlist& bl, size_t len) {
int sync_read(const std::string& oid, bufferlist& bl, size_t len) override {
return io_ctx.read(oid, bl, len, 0);
}
int sync_write(const std::string& oid, bufferlist& bl, size_t len) {
int sync_write(const std::string& oid, bufferlist& bl, size_t len) override {
return io_ctx.write_full(oid, bl);
}
int sync_remove(const std::string& oid) {
int sync_remove(const std::string& oid) override {
return io_ctx.remove(oid);
}
bool completion_is_done(int slot) {
bool completion_is_done(int slot) override {
return completions[slot]->is_safe();
}
int completion_wait(int slot) {
int completion_wait(int slot) override {
return completions[slot]->wait_for_safe_and_cb();
}
int completion_ret(int slot) {
int completion_ret(int slot) override {
return completions[slot]->get_return_value();
}
bool get_objects(std::list<Object>* objects, int num) {
bool get_objects(std::list<Object>* objects, int num) override {
int count = 0;
if (!iterator_valid) {
@ -992,7 +992,7 @@ protected:
return true;
}
void set_namespace( const std::string& ns) {
void set_namespace( const std::string& ns) override {
io_ctx.set_namespace(ns);
}

View File

@ -38,7 +38,7 @@ void buf_to_hex(const unsigned char *buf, int len, char *str)
class C_Watch : public WatchCtx {
public:
C_Watch() {}
void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) {
void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) override {
cout << "C_Watch::notify() opcode=" << (int)opcode << " ver=" << ver << std::endl;
}
};