From: Danny Al-Gaaf Date: Thu, 28 Jan 2016 15:36:23 +0000 (+0100) Subject: make ctors with one argument explicit X-Git-Tag: v10.0.4~86^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bbf0582342437d8deec7a42f395a33b0f09a1ed7;p=ceph.git make ctors with one argument explicit Use explicit keyword for constructors with one argument to prevent implicit usage as conversion functions. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/auth/AuthClientHandler.h b/src/auth/AuthClientHandler.h index e12cbb914f86..9b34a6f8270b 100644 --- a/src/auth/AuthClientHandler.h +++ b/src/auth/AuthClientHandler.h @@ -40,7 +40,7 @@ protected: RWLock lock; public: - AuthClientHandler(CephContext *cct_) + explicit AuthClientHandler(CephContext *cct_) : cct(cct_), global_id(0), want(CEPH_ENTITY_TYPE_AUTH), have(0), need(0), lock("AuthClientHandler::lock") {} virtual ~AuthClientHandler() {} diff --git a/src/auth/AuthServiceHandler.h b/src/auth/AuthServiceHandler.h index 429a5501be52..ccadbb0fa54a 100644 --- a/src/auth/AuthServiceHandler.h +++ b/src/auth/AuthServiceHandler.h @@ -29,7 +29,7 @@ public: EntityName entity_name; uint64_t global_id; - AuthServiceHandler(CephContext *cct_) : cct(cct_), global_id(0) {} + explicit AuthServiceHandler(CephContext *cct_) : cct(cct_), global_id(0) {} virtual ~AuthServiceHandler() { } diff --git a/src/auth/AuthSessionHandler.h b/src/auth/AuthSessionHandler.h index c560119ec775..b1f30a400670 100644 --- a/src/auth/AuthSessionHandler.h +++ b/src/auth/AuthSessionHandler.h @@ -44,7 +44,7 @@ public: int messages_encrypted; int messages_decrypted; - AuthSessionHandler(CephContext *cct_) : cct(cct_), protocol(CEPH_AUTH_UNKNOWN), messages_signed(0), + explicit AuthSessionHandler(CephContext *cct_) : cct(cct_), protocol(CEPH_AUTH_UNKNOWN), messages_signed(0), signatures_checked(0), signatures_matched(0), signatures_failed(0), messages_encrypted(0), messages_decrypted(0) {} diff --git a/src/auth/cephx/CephxKeyServer.h b/src/auth/cephx/CephxKeyServer.h index 250331d71167..7d95fadc8821 100644 --- a/src/auth/cephx/CephxKeyServer.h +++ b/src/auth/cephx/CephxKeyServer.h @@ -35,7 +35,7 @@ struct KeyServerData { version_t rotating_ver; map rotating_secrets; - KeyServerData(KeyRing *extra) + explicit KeyServerData(KeyRing *extra) : version(0), extra_secrets(extra), rotating_ver(0) {} diff --git a/src/auth/cephx/CephxProtocol.h b/src/auth/cephx/CephxProtocol.h index f08f07d84b9f..4a5fb5d3dcbe 100644 --- a/src/auth/cephx/CephxProtocol.h +++ b/src/auth/cephx/CephxProtocol.h @@ -277,7 +277,7 @@ private: public: uint64_t nonce; - CephXAuthorizer(CephContext *cct_) + explicit CephXAuthorizer(CephContext *cct_) : AuthAuthorizer(CEPH_AUTH_CEPHX), cct(cct_), nonce(0) {} bool build_authorizer(); @@ -320,7 +320,7 @@ struct CephXTicketManager { tickets_map_t tickets_map; uint64_t global_id; - CephXTicketManager(CephContext *cct_) : global_id(0), cct(cct_) {} + explicit CephXTicketManager(CephContext *cct_) : global_id(0), cct(cct_) {} bool verify_service_ticket_reply(CryptoKey& principal_secret, bufferlist::iterator& indata); diff --git a/src/auth/none/AuthNoneServiceHandler.h b/src/auth/none/AuthNoneServiceHandler.h index c2bbbc8c8cf0..a45dbbfce4b3 100644 --- a/src/auth/none/AuthNoneServiceHandler.h +++ b/src/auth/none/AuthNoneServiceHandler.h @@ -22,7 +22,7 @@ class CephContext; class AuthNoneServiceHandler : public AuthServiceHandler { public: - AuthNoneServiceHandler(CephContext *cct_) + explicit AuthNoneServiceHandler(CephContext *cct_) : AuthServiceHandler(cct_) {} ~AuthNoneServiceHandler() {} diff --git a/src/client/Client.cc b/src/client/Client.cc index 2f3d6dffe5b8..d6b08bb07399 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -3793,7 +3793,7 @@ class C_Client_Remount : public Context { private: Client *client; public: - C_Client_Remount(Client *c) : client(c) {} + explicit C_Client_Remount(Client *c) : client(c) {} void finish(int r) { assert (r == 0); r = client->remount_cb(client->callback_handle); @@ -5564,7 +5564,7 @@ void Client::unmount() class C_C_Tick : public Context { Client *client; public: - C_C_Tick(Client *c) : client(c) {} + explicit C_C_Tick(Client *c) : client(c) {} void finish(int r) { // Called back via Timer, which takes client_lock for us assert(client->client_lock.is_locked_by_me()); diff --git a/src/client/Client.h b/src/client/Client.h index a3415b099c09..ccee4862016d 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -118,7 +118,7 @@ struct DirEntry { string d_name; struct stat st; int stmask; - DirEntry(const string &s) : d_name(s), stmask(0) {} + explicit DirEntry(const string &s) : d_name(s), stmask(0) {} DirEntry(const string &n, struct stat& s, int stm) : d_name(n), st(s), stmask(stm) {} }; @@ -192,7 +192,7 @@ struct dir_result_t { string at_cache_name; // last entry we successfully returned - dir_result_t(Inode *in); + explicit dir_result_t(Inode *in); frag_t frag() { return frag_t(offset >> SHIFT); } unsigned fragpos() { return offset & MASK; } @@ -231,7 +231,7 @@ class Client : public Dispatcher, public md_config_obs_t { class CommandHook : public AdminSocketHook { Client *m_client; public: - CommandHook(Client *client); + explicit CommandHook(Client *client); bool call(std::string command, cmdmap_t &cmdmap, std::string format, bufferlist& out); }; diff --git a/src/client/ClientSnapRealm.h b/src/client/ClientSnapRealm.h index 040430a53429..ccb129d78bf3 100644 --- a/src/client/ClientSnapRealm.h +++ b/src/client/ClientSnapRealm.h @@ -31,7 +31,7 @@ private: public: xlist inodes_with_caps; - SnapRealm(inodeno_t i) : + explicit SnapRealm(inodeno_t i) : ino(i), nref(0), created(0), seq(0), pparent(NULL) { } diff --git a/src/client/Dir.h b/src/client/Dir.h index 0e6d28bbb298..a7f484d45f3c 100644 --- a/src/client/Dir.h +++ b/src/client/Dir.h @@ -11,7 +11,7 @@ class Dir { uint64_t release_count; uint64_t ordered_count; - Dir(Inode* in) : release_count(0), ordered_count(0) { parent_inode = in; } + explicit Dir(Inode* in) : release_count(0), ordered_count(0) { parent_inode = in; } bool is_empty() { return dentries.empty(); } }; diff --git a/src/client/Inode.h b/src/client/Inode.h index bd10ad7626c8..dd2ad995e83e 100644 --- a/src/client/Inode.h +++ b/src/client/Inode.h @@ -66,7 +66,7 @@ struct CapSnap { uint64_t flush_tid; xlist::item flushing_item; - CapSnap(Inode *i) + explicit CapSnap(Inode *i) : in(i), issued(0), dirty(0), size(0), time_warp_seq(0), mode(0), uid(0), gid(0), xattr_version(0), inline_version(0), writing(false), dirty_data(false), flush_tid(0), @@ -95,7 +95,7 @@ private: } ~QuotaTree() {} public: - QuotaTree(Inode *i) : + explicit QuotaTree(Inode *i) : _in(i), _ancestor_ref(0), _ancestor(NULL), diff --git a/src/client/MetaRequest.h b/src/client/MetaRequest.h index 7a6bd3fb0f81..d21e5c54e47e 100644 --- a/src/client/MetaRequest.h +++ b/src/client/MetaRequest.h @@ -81,7 +81,7 @@ public: InodeRef target; - MetaRequest(int op) : + explicit MetaRequest(int op) : _dentry(NULL), _old_dentry(NULL), abort_rc(0), tid(0), inode_drop(0), inode_unless(0), diff --git a/src/client/Trace.h b/src/client/Trace.h index 24145a8b84c7..7da2eaf896d7 100644 --- a/src/client/Trace.h +++ b/src/client/Trace.h @@ -39,7 +39,7 @@ class Trace { string line; public: - Trace(const char* f) : _line(0), filename(f), fs(0) {} + explicit Trace(const char* f) : _line(0), filename(f), fs(0) {} ~Trace() { delete fs; } diff --git a/src/client/hypertable/CephBroker.h b/src/client/hypertable/CephBroker.h index 542ff668f155..a0d180c4da28 100644 --- a/src/client/hypertable/CephBroker.h +++ b/src/client/hypertable/CephBroker.h @@ -58,7 +58,7 @@ namespace Hypertable { class OpenFileDataCephPtr : public OpenFileDataPtr { public: OpenFileDataCephPtr() : OpenFileDataPtr() { } - OpenFileDataCephPtr(OpenFileDataCeph *ofdl) : OpenFileDataPtr(ofdl, true) { } + explicit OpenFileDataCephPtr(OpenFileDataCeph *ofdl) : OpenFileDataPtr(ofdl, true) { } OpenFileDataCeph *operator->() const { return static_cast(get()); } }; @@ -67,7 +67,7 @@ namespace Hypertable { */ class CephBroker : public DfsBroker::Broker { public: - CephBroker(PropertiesPtr& cfg); + explicit CephBroker(PropertiesPtr& cfg); virtual ~CephBroker(); virtual void open(ResponseCallbackOpen *cb, const char *fname, diff --git a/src/cls/log/cls_log_client.cc b/src/cls/log/cls_log_client.cc index d0c6603d689d..0334deb57d3a 100644 --- a/src/cls/log/cls_log_client.cc +++ b/src/cls/log/cls_log_client.cc @@ -127,7 +127,7 @@ void cls_log_list(librados::ObjectReadOperation& op, utime_t& from, utime_t& to, class LogInfoCtx : public ObjectOperationCompletion { cls_log_header *header; public: - LogInfoCtx(cls_log_header *_header) : header(_header) {} + explicit LogInfoCtx(cls_log_header *_header) : header(_header) {} void handle_completion(int r, bufferlist& outbl) { if (r >= 0) { cls_log_info_ret ret; diff --git a/src/cls/replica_log/cls_replica_log_ops.h b/src/cls/replica_log/cls_replica_log_ops.h index 0905bb94e847..c5361a019f27 100644 --- a/src/cls/replica_log/cls_replica_log_ops.h +++ b/src/cls/replica_log/cls_replica_log_ops.h @@ -16,7 +16,7 @@ struct cls_replica_log_delete_marker_op { string entity_id; cls_replica_log_delete_marker_op() {} - cls_replica_log_delete_marker_op(const string& id) : entity_id(id) {} + explicit cls_replica_log_delete_marker_op(const string& id) : entity_id(id) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); @@ -39,7 +39,7 @@ WRITE_CLASS_ENCODER(cls_replica_log_delete_marker_op) struct cls_replica_log_set_marker_op { cls_replica_log_progress_marker marker; cls_replica_log_set_marker_op() {} - cls_replica_log_set_marker_op(const cls_replica_log_progress_marker& m) : + explicit cls_replica_log_set_marker_op(const cls_replica_log_progress_marker& m) : marker(m) {} void encode(bufferlist& bl) const { diff --git a/src/cls/rgw/cls_rgw_client.cc b/src/cls/rgw/cls_rgw_client.cc index e6ac56b822c3..62034f2d1ab9 100644 --- a/src/cls/rgw/cls_rgw_client.cc +++ b/src/cls/rgw/cls_rgw_client.cc @@ -476,7 +476,7 @@ int CLSRGWIssueGetDirHeader::issue_op(int shard_id, const string& oid) class GetDirHeaderCompletion : public ObjectOperationCompletion { RGWGetDirHeader_CB *ret_ctx; public: - GetDirHeaderCompletion(RGWGetDirHeader_CB *_ctx) : ret_ctx(_ctx) {} + explicit GetDirHeaderCompletion(RGWGetDirHeader_CB *_ctx) : ret_ctx(_ctx) {} ~GetDirHeaderCompletion() { ret_ctx->put(); } diff --git a/src/cls/version/cls_version_client.cc b/src/cls/version/cls_version_client.cc index 70d5ebe67695..191fa4beeb72 100644 --- a/src/cls/version/cls_version_client.cc +++ b/src/cls/version/cls_version_client.cc @@ -60,7 +60,7 @@ void cls_version_check(librados::ObjectOperation& op, obj_version& objv, Version class VersionReadCtx : public ObjectOperationCompletion { obj_version *objv; public: - VersionReadCtx(obj_version *_objv) : objv(_objv) {} + explicit VersionReadCtx(obj_version *_objv) : objv(_objv) {} void handle_completion(int r, bufferlist& outbl) { if (r >= 0) { cls_version_read_ret ret; diff --git a/src/common/BackTrace.h b/src/common/BackTrace.h index 4157f74a3b3c..addfdeeeb28d 100644 --- a/src/common/BackTrace.h +++ b/src/common/BackTrace.h @@ -18,7 +18,7 @@ struct BackTrace { size_t size; char **strings; - BackTrace(int s) : skip(s) { + explicit BackTrace(int s) : skip(s) { #ifdef HAVE_EXECINFO_H size = backtrace(array, max); strings = backtrace_symbols(array, size); diff --git a/src/common/DecayCounter.h b/src/common/DecayCounter.h index 4e69a8869630..529e50a30b3d 100644 --- a/src/common/DecayCounter.h +++ b/src/common/DecayCounter.h @@ -56,7 +56,7 @@ public: void dump(Formatter *f) const; static void generate_test_instances(list& ls); - DecayCounter(const utime_t &now) + explicit DecayCounter(const utime_t &now) : val(0), delta(0), vel(0), last_decay(now) { } diff --git a/src/common/Finisher.h b/src/common/Finisher.h index 26a41b7461e3..4d494ed15333 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -62,7 +62,7 @@ class Finisher { struct FinisherThread : public Thread { Finisher *fin; - FinisherThread(Finisher *f) : fin(f) {} + explicit FinisherThread(Finisher *f) : fin(f) {} void* entry() { return (void*)fin->finisher_thread_entry(); } } finisher_thread; @@ -134,7 +134,7 @@ class Finisher { /// Construct an anonymous Finisher. /// Anonymous finishers do not log their queue length. - Finisher(CephContext *cct_) : + explicit Finisher(CephContext *cct_) : cct(cct_), finisher_lock("Finisher::finisher_lock"), finisher_stop(false), finisher_running(false), thread_name("fn_anonymous"), logger(0), diff --git a/src/common/Formatter.h b/src/common/Formatter.h index f67aebd04dbe..d74fab7a12d5 100644 --- a/src/common/Formatter.h +++ b/src/common/Formatter.h @@ -91,7 +91,7 @@ namespace ceph { class JSONFormatter : public Formatter { public: - JSONFormatter(bool p = false); + explicit JSONFormatter(bool p = false); virtual void set_status(int status, const char* status_name) {}; virtual void output_header() {}; @@ -178,7 +178,7 @@ namespace ceph { class TableFormatter : public Formatter { public: - TableFormatter(bool keyval = false); + explicit TableFormatter(bool keyval = false); virtual void set_status(int status, const char* status_name) {}; virtual void output_header() {}; diff --git a/src/common/HTMLFormatter.h b/src/common/HTMLFormatter.h index 50d0777973f6..c165efc99f6c 100644 --- a/src/common/HTMLFormatter.h +++ b/src/common/HTMLFormatter.h @@ -20,7 +20,7 @@ namespace ceph { class HTMLFormatter : public XMLFormatter { public: - HTMLFormatter(bool pretty = false); + explicit HTMLFormatter(bool pretty = false); ~HTMLFormatter(); void reset(); diff --git a/src/common/HeartbeatMap.h b/src/common/HeartbeatMap.h index 61c2f9048d83..8ab5f648a035 100644 --- a/src/common/HeartbeatMap.h +++ b/src/common/HeartbeatMap.h @@ -46,7 +46,7 @@ struct heartbeat_handle_d { time_t grace, suicide_grace; std::list::iterator list_item; - heartbeat_handle_d(const std::string& n) + explicit heartbeat_handle_d(const std::string& n) : name(n), grace(0), suicide_grace(0) { } }; @@ -74,7 +74,7 @@ class HeartbeatMap { // get the number of total workers int get_total_workers() const; - HeartbeatMap(CephContext *cct); + explicit HeartbeatMap(CephContext *cct); ~HeartbeatMap(); private: diff --git a/src/common/Initialize.h b/src/common/Initialize.h index 35414d64be8f..78ad5ec6973f 100644 --- a/src/common/Initialize.h +++ b/src/common/Initialize.h @@ -69,7 +69,7 @@ class Initialize { * function should normally contain an internal guard so that it * only performs its initialization the first time it is invoked. */ - Initialize(void (*func)()) { + explicit Initialize(void (*func)()) { (*func)(); } diff --git a/src/common/MemoryModel.h b/src/common/MemoryModel.h index 1b8d18557891..0d68dc5daa93 100644 --- a/src/common/MemoryModel.h +++ b/src/common/MemoryModel.h @@ -43,7 +43,7 @@ private: void _sample(snap *p); public: - MemoryModel(CephContext *cct); + explicit MemoryModel(CephContext *cct); void sample(snap *p = 0) { _sample(&last); if (p) diff --git a/src/common/Mutex.h b/src/common/Mutex.h index 6a4e6b385eea..09e8f8cd6c96 100644 --- a/src/common/Mutex.h +++ b/src/common/Mutex.h @@ -111,7 +111,7 @@ public: Mutex &mutex; public: - Locker(Mutex& m) : mutex(m) { + explicit Locker(Mutex& m) : mutex(m) { mutex.Lock(); } ~Locker() { diff --git a/src/common/PluginRegistry.h b/src/common/PluginRegistry.h index 6757ce10a85f..ab9abc1030cf 100644 --- a/src/common/PluginRegistry.h +++ b/src/common/PluginRegistry.h @@ -39,7 +39,7 @@ namespace ceph { void *library; CephContext *cct; - Plugin(CephContext *cct) : cct(cct) {} + explicit Plugin(CephContext *cct) : cct(cct) {} virtual ~Plugin() {} }; @@ -51,7 +51,7 @@ namespace ceph { bool disable_dlclose; std::map > plugins; - PluginRegistry(CephContext *cct); + explicit PluginRegistry(CephContext *cct); ~PluginRegistry(); int add(const std::string& type, const std::string& name, diff --git a/src/common/RWLock.h b/src/common/RWLock.h index d3b5cdb55336..9b0de9ed9678 100644 --- a/src/common/RWLock.h +++ b/src/common/RWLock.h @@ -140,7 +140,7 @@ public: bool locked; public: - RLocker(const RWLock& lock) : m_lock(lock) { + explicit RLocker(const RWLock& lock) : m_lock(lock) { m_lock.get_read(); locked = true; } @@ -162,7 +162,7 @@ public: bool locked; public: - WLocker(RWLock& lock) : m_lock(lock) { + explicit WLocker(RWLock& lock) : m_lock(lock) { m_lock.get_write(); locked = true; } @@ -192,7 +192,7 @@ public: LockState state; public: - Context(RWLock& l) : lock(l), state(Untaken) {} + explicit Context(RWLock& l) : lock(l), state(Untaken) {} Context(RWLock& l, LockState s) : lock(l), state(s) {} void get_write() { diff --git a/src/common/Timer.cc b/src/common/Timer.cc index 1160541acae3..b71511dc4e33 100644 --- a/src/common/Timer.cc +++ b/src/common/Timer.cc @@ -33,7 +33,7 @@ class SafeTimerThread : public Thread { SafeTimer *parent; public: - SafeTimerThread(SafeTimer *s) : parent(s) {} + explicit SafeTimerThread(SafeTimer *s) : parent(s) {} void *entry() { parent->timer_thread(); return NULL; diff --git a/src/common/TracepointProvider.h b/src/common/TracepointProvider.h index 447e2dec07ce..9f5ec11f3c43 100644 --- a/src/common/TracepointProvider.h +++ b/src/common/TracepointProvider.h @@ -45,7 +45,7 @@ public: template class TypedSingleton : public Singleton { public: - TypedSingleton(CephContext *cct) + explicit TypedSingleton(CephContext *cct) : Singleton(cct, traits.library, traits.config_key) { } }; diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index 89b990a8b410..3663290ec08e 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -56,7 +56,7 @@ class OpTracker { class RemoveOnDelete { OpTracker *tracker; public: - RemoveOnDelete(OpTracker *tracker) : tracker(tracker) {} + explicit RemoveOnDelete(OpTracker *tracker) : tracker(tracker) {} void operator()(TrackedOp *op); }; friend class RemoveOnDelete; @@ -65,7 +65,7 @@ class OpTracker { struct ShardedTrackingData { Mutex ops_in_flight_lock_sharded; xlist ops_in_flight_sharded; - ShardedTrackingData(string lock_name): + explicit ShardedTrackingData(string lock_name): ops_in_flight_lock_sharded(lock_name.c_str()) {} }; vector sharded_in_flight_list; diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index 1d51ef54227a..aa0146fe1c3b 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -473,7 +473,7 @@ public: class HelpHook : public AdminSocketHook { AdminSocket *m_as; public: - HelpHook(AdminSocket *as) : m_as(as) {} + explicit HelpHook(AdminSocket *as) : m_as(as) {} bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) { Formatter *f = Formatter::create(format, "json-pretty", "json-pretty"); f->open_object_section("help"); @@ -495,7 +495,7 @@ public: class GetdescsHook : public AdminSocketHook { AdminSocket *m_as; public: - GetdescsHook(AdminSocket *as) : m_as(as) {} + explicit GetdescsHook(AdminSocket *as) : m_as(as) {} bool call(string command, cmdmap_t &cmdmap, string format, bufferlist& out) { int cmdnum = 0; JSONFormatter jf(false); diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 864c7eefb9eb..bd97b01cd88f 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -165,7 +165,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; mutable simple_spinlock_t crc_spinlock; map, pair > crc_map; - raw(unsigned l) + explicit raw(unsigned l) : data(NULL), len(l), nref(0), crc_spinlock(SIMPLE_SPINLOCK_INITIALIZER) { } @@ -236,7 +236,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; class buffer::raw_malloc : public buffer::raw { public: - raw_malloc(unsigned l) : raw(l) { + explicit raw_malloc(unsigned l) : raw(l) { if (len) { data = (char *)malloc(len); if (!data) @@ -265,7 +265,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; #ifndef __CYGWIN__ class buffer::raw_mmap_pages : public buffer::raw { public: - raw_mmap_pages(unsigned l) : raw(l) { + explicit raw_mmap_pages(unsigned l) : raw(l) { data = (char*)::mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); if (!data) throw bad_alloc(); @@ -347,7 +347,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; #ifdef CEPH_HAVE_SPLICE class buffer::raw_pipe : public buffer::raw { public: - raw_pipe(unsigned len) : raw(len), source_consumed(false) { + explicit raw_pipe(unsigned len) : raw(len), source_consumed(false) { size_t max = get_max_pipe_size(); if (len > max) { bdout << "raw_pipe: requested length " << len @@ -527,7 +527,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; */ class buffer::raw_char : public buffer::raw { public: - raw_char(unsigned l) : raw(l) { + explicit raw_char(unsigned l) : raw(l) { if (len) data = new char[len]; else @@ -552,7 +552,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; class buffer::raw_unshareable : public buffer::raw { public: - raw_unshareable(unsigned l) : raw(l) { + explicit raw_unshareable(unsigned l) : raw(l) { if (len) data = new char[len]; else diff --git a/src/common/ceph_argparse.h b/src/common/ceph_argparse.h index 6ad0234df027..b504b3508fb7 100644 --- a/src/common/ceph_argparse.h +++ b/src/common/ceph_argparse.h @@ -35,7 +35,7 @@ class CephInitParameters { public: - CephInitParameters(uint32_t module_type_); + explicit CephInitParameters(uint32_t module_type_); std::list get_conf_files() const; uint32_t module_type; diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 91d6b97d0c56..bd74967cbb6b 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -46,7 +46,7 @@ namespace { class LockdepObs : public md_config_obs_t { public: - LockdepObs(CephContext *cct) : m_cct(cct), m_registered(false) { + explicit LockdepObs(CephContext *cct) : m_cct(cct), m_registered(false) { } virtual ~LockdepObs() { if (m_registered) { @@ -80,7 +80,7 @@ private: class CephContextServiceThread : public Thread { public: - CephContextServiceThread(CephContext *cct) + explicit CephContextServiceThread(CephContext *cct) : _lock("CephContextServiceThread::_lock"), _reopen_logs(false), _exit_thread(false), _cct(cct) { @@ -149,7 +149,7 @@ class LogObs : public md_config_obs_t { ceph::log::Log *log; public: - LogObs(ceph::log::Log *l) : log(l) {} + explicit LogObs(ceph::log::Log *l) : log(l) {} const char** get_tracked_conf_keys() const { static const char *KEYS[] = { @@ -201,7 +201,7 @@ class CephContextObs : public md_config_obs_t { CephContext *cct; public: - CephContextObs(CephContext *cct) : cct(cct) {} + explicit CephContextObs(CephContext *cct) : cct(cct) {} const char** get_tracked_conf_keys() const { static const char *KEYS[] = { @@ -264,7 +264,7 @@ class CephContextHook : public AdminSocketHook { CephContext *m_cct; public: - CephContextHook(CephContext *cct) : m_cct(cct) {} + explicit CephContextHook(CephContext *cct) : m_cct(cct) {} bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& out) { diff --git a/src/common/hobject.h b/src/common/hobject.h index d71554422895..b823708441ac 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -285,7 +285,7 @@ public: struct Comparator { bool bitwise; - Comparator(bool b) : bitwise(b) {} + explicit Comparator(bool b) : bitwise(b) {} bool operator()(const hobject_t& l, const hobject_t& r) const { if (bitwise) return cmp_bitwise(l, r) < 0; @@ -295,7 +295,7 @@ public: }; struct ComparatorWithDefault { bool bitwise; - ComparatorWithDefault(bool b=true) : bitwise(b) {} + explicit ComparatorWithDefault(bool b=true) : bitwise(b) {} bool operator()(const hobject_t& l, const hobject_t& r) const { if (bitwise) return cmp_bitwise(l, r) < 0; @@ -463,7 +463,7 @@ public: struct Comparator { bool bitwise; - Comparator(bool b) : bitwise(b) {} + explicit Comparator(bool b) : bitwise(b) {} bool operator()(const ghobject_t& l, const ghobject_t& r) const { if (bitwise) return cmp_bitwise(l, r) < 0; diff --git a/src/common/obj_bencher.cc b/src/common/obj_bencher.cc index a77febc6cb81..c6b3eb26fab3 100644 --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -293,7 +293,7 @@ int ObjBencher::aio_bench( } struct lock_cond { - lock_cond(Mutex *_lock) : lock(_lock) {} + explicit lock_cond(Mutex *_lock) : lock(_lock) {} Mutex *lock; Cond cond; }; diff --git a/src/common/obj_bencher.h b/src/common/obj_bencher.h index a717c5da0ede..e39e7df15731 100644 --- a/src/common/obj_bencher.h +++ b/src/common/obj_bencher.h @@ -105,7 +105,7 @@ protected: ostream& out(ostream& os); ostream& out(ostream& os, utime_t& t); public: - ObjBencher(CephContext *cct_) : show_time(false), cct(cct_), lock("ObjBencher::lock") {} + explicit ObjBencher(CephContext *cct_) : show_time(false), cct(cct_), lock("ObjBencher::lock") {} virtual ~ObjBencher() {} int aio_bench( int operation, int secondsToRun, diff --git a/src/common/pick_address.cc b/src/common/pick_address.cc index f6853622ff9b..a47a1d946a4c 100644 --- a/src/common/pick_address.cc +++ b/src/common/pick_address.cc @@ -51,7 +51,7 @@ static const struct sockaddr *find_ip_in_subnet_list(CephContext *cct, // observe this change struct Observer : public md_config_obs_t { const char *keys[2]; - Observer(const char *c) { + explicit Observer(const char *c) { keys[0] = c; keys[1] = NULL; } diff --git a/src/compressor/AsyncCompressor.h b/src/compressor/AsyncCompressor.h index cec2e961d4e3..8be4f4e55bfc 100644 --- a/src/compressor/AsyncCompressor.h +++ b/src/compressor/AsyncCompressor.h @@ -108,7 +108,7 @@ class AsyncCompressor { void _decompress(bufferlist &in, bufferlist &out); public: - AsyncCompressor(CephContext *c); + explicit AsyncCompressor(CephContext *c); virtual ~AsyncCompressor() {} int get_cpuid(int id) { diff --git a/src/compressor/CompressionPlugin.h b/src/compressor/CompressionPlugin.h index d699d007fd68..be1f6b83a8ba 100644 --- a/src/compressor/CompressionPlugin.h +++ b/src/compressor/CompressionPlugin.h @@ -28,7 +28,7 @@ namespace ceph { public: CompressorRef compressor; - CompressionPlugin(CephContext *cct) : Plugin(cct), + explicit CompressionPlugin(CephContext *cct) : Plugin(cct), compressor(0) {} diff --git a/src/compressor/snappy/CompressionPluginSnappy.cc b/src/compressor/snappy/CompressionPluginSnappy.cc index 2030d56bf251..d0780f38d31b 100644 --- a/src/compressor/snappy/CompressionPluginSnappy.cc +++ b/src/compressor/snappy/CompressionPluginSnappy.cc @@ -23,7 +23,7 @@ class CompressionPluginSnappy : public CompressionPlugin { public: - CompressionPluginSnappy(CephContext* cct) : CompressionPlugin(cct) + explicit CompressionPluginSnappy(CephContext* cct) : CompressionPlugin(cct) {} virtual int factory(CompressorRef *cs, diff --git a/src/compressor/snappy/SnappyCompressor.h b/src/compressor/snappy/SnappyCompressor.h index 8a6166bd975b..ae2ca835fd53 100644 --- a/src/compressor/snappy/SnappyCompressor.h +++ b/src/compressor/snappy/SnappyCompressor.h @@ -26,7 +26,7 @@ class BufferlistSource : public snappy::Source { size_t left; public: - BufferlistSource(const bufferlist &data): pb(data.buffers().begin()), pb_off(0), left(data.length()) {} + explicit BufferlistSource(const bufferlist &data): pb(data.buffers().begin()), pb_off(0), left(data.length()) {} virtual ~BufferlistSource() {} virtual size_t Available() const { return left; } virtual const char* Peek(size_t* len) { diff --git a/src/crush/CrushTreeDumper.h b/src/crush/CrushTreeDumper.h index abb5fca05ca3..41cf1a9af4ea 100644 --- a/src/crush/CrushTreeDumper.h +++ b/src/crush/CrushTreeDumper.h @@ -63,7 +63,7 @@ namespace CrushTreeDumper { template class Dumper : public list { public: - Dumper(const CrushWrapper *crush_) : crush(crush_) { + explicit Dumper(const CrushWrapper *crush_) : crush(crush_) { crush->find_roots(roots); root = roots.begin(); } @@ -155,7 +155,7 @@ namespace CrushTreeDumper { class FormattingDumper : public Dumper { public: - FormattingDumper(const CrushWrapper *crush) : Dumper(crush) {} + explicit FormattingDumper(const CrushWrapper *crush) : Dumper(crush) {} protected: virtual void dump_item(const Item &qi, Formatter *f) { diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 8a2d28b94550..96df08eac054 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1498,7 +1498,7 @@ namespace { typedef CrushTreeDumper::Item Item; const CrushWrapper *crush; public: - TreeDumper(const CrushWrapper *crush) + explicit TreeDumper(const CrushWrapper *crush) : crush(crush) {} void dump(Formatter *f) { @@ -1670,7 +1670,7 @@ class CrushTreePlainDumper : public CrushTreeDumper::Dumper { public: typedef CrushTreeDumper::Dumper Parent; - CrushTreePlainDumper(const CrushWrapper *crush) + explicit CrushTreePlainDumper(const CrushWrapper *crush) : Parent(crush) {} void dump(ostream *out) { @@ -1704,7 +1704,7 @@ class CrushTreeFormattingDumper : public CrushTreeDumper::FormattingDumper { public: typedef CrushTreeDumper::FormattingDumper Parent; - CrushTreeFormattingDumper(const CrushWrapper *crush) + explicit CrushTreeFormattingDumper(const CrushWrapper *crush) : Parent(crush) {} void dump(Formatter *f) { diff --git a/src/erasure-code/jerasure/ErasureCodeJerasure.h b/src/erasure-code/jerasure/ErasureCodeJerasure.h index df60dac6a35f..67fc360a67e9 100644 --- a/src/erasure-code/jerasure/ErasureCodeJerasure.h +++ b/src/erasure-code/jerasure/ErasureCodeJerasure.h @@ -36,7 +36,7 @@ public: string ruleset_failure_domain; bool per_chunk_alignment; - ErasureCodeJerasure(const char *_technique) : + explicit ErasureCodeJerasure(const char *_technique) : k(0), DEFAULT_K("2"), m(0), @@ -155,7 +155,7 @@ public: int **schedule; int packetsize; - ErasureCodeJerasureCauchy(const char *technique) : + explicit ErasureCodeJerasureCauchy(const char *technique) : ErasureCodeJerasure(technique), bitmatrix(0), schedule(0) @@ -208,7 +208,7 @@ public: int **schedule; int packetsize; - ErasureCodeJerasureLiberation(const char *technique = "liberation") : + explicit ErasureCodeJerasureLiberation(const char *technique = "liberation") : ErasureCodeJerasure(technique), bitmatrix(0), schedule(0) diff --git a/src/erasure-code/lrc/ErasureCodeLrc.h b/src/erasure-code/lrc/ErasureCodeLrc.h index ffc7748c0c91..e54688a97bb8 100644 --- a/src/erasure-code/lrc/ErasureCodeLrc.h +++ b/src/erasure-code/lrc/ErasureCodeLrc.h @@ -49,7 +49,7 @@ public: static const string DEFAULT_KML; struct Layer { - Layer(string _chunks_map) : chunks_map(_chunks_map) { } + explicit Layer(string _chunks_map) : chunks_map(_chunks_map) { } ErasureCodeInterfaceRef erasure_code; vector data; vector coding; @@ -74,7 +74,7 @@ public: }; vector ruleset_steps; - ErasureCodeLrc(const std::string &dir) + explicit ErasureCodeLrc(const std::string &dir) : directory(dir), chunk_count(0), data_chunk_count(0), ruleset_root("default") { diff --git a/src/journal/JournalPlayer.cc b/src/journal/JournalPlayer.cc index b78f29c10451..a2355f520635 100644 --- a/src/journal/JournalPlayer.cc +++ b/src/journal/JournalPlayer.cc @@ -18,7 +18,7 @@ namespace { struct C_HandleComplete : public Context { ReplayHandler *replay_handler; - C_HandleComplete(ReplayHandler *_replay_handler) + explicit C_HandleComplete(ReplayHandler *_replay_handler) : replay_handler(_replay_handler) { replay_handler->get(); } @@ -33,7 +33,7 @@ struct C_HandleComplete : public Context { struct C_HandleEntriesAvailable : public Context { ReplayHandler *replay_handler; - C_HandleEntriesAvailable(ReplayHandler *_replay_handler) + explicit C_HandleEntriesAvailable(ReplayHandler *_replay_handler) : replay_handler(_replay_handler) { replay_handler->get(); } diff --git a/src/kv/KineticStore.h b/src/kv/KineticStore.h index 2d02c8c51eed..c2be802dfab1 100644 --- a/src/kv/KineticStore.h +++ b/src/kv/KineticStore.h @@ -45,7 +45,7 @@ class KineticStore : public KeyValueDB { int do_open(ostream &out, bool create_if_missing); public: - KineticStore(CephContext *c); + explicit KineticStore(CephContext *c); ~KineticStore(); static int _test_init(CephContext *c); @@ -81,7 +81,7 @@ public: vector ops; KineticStore *db; - KineticTransactionImpl(KineticStore *db) : db(db) {} + explicit KineticTransactionImpl(KineticStore *db) : db(db) {} void set( const string &prefix, const string &k, @@ -115,7 +115,7 @@ public: kinetic::BlockingKineticConnection *kinetic_conn; kinetic::KineticStatus kinetic_status; public: - KineticWholeSpaceIteratorImpl(kinetic::BlockingKineticConnection *conn); + explicit KineticWholeSpaceIteratorImpl(kinetic::BlockingKineticConnection *conn); virtual ~KineticWholeSpaceIteratorImpl() { } int seek_to_first() { diff --git a/src/kv/LevelDBStore.cc b/src/kv/LevelDBStore.cc index 5ea75b925290..c47532d82652 100644 --- a/src/kv/LevelDBStore.cc +++ b/src/kv/LevelDBStore.cc @@ -18,7 +18,7 @@ using std::string; class CephLevelDBLogger : public leveldb::Logger { CephContext *cct; public: - CephLevelDBLogger(CephContext *c) : cct(c) { + explicit CephLevelDBLogger(CephContext *c) : cct(c) { cct->get(); } ~CephLevelDBLogger() { diff --git a/src/kv/LevelDBStore.h b/src/kv/LevelDBStore.h index 8a201dfa08d5..8260f8b351ec 100644 --- a/src/kv/LevelDBStore.h +++ b/src/kv/LevelDBStore.h @@ -73,7 +73,7 @@ class LevelDBStore : public KeyValueDB { class CompactThread : public Thread { LevelDBStore *db; public: - CompactThread(LevelDBStore *d) : db(d) {} + explicit CompactThread(LevelDBStore *d) : db(d) {} void *entry() { db->compact_thread_entry(); return NULL; @@ -185,7 +185,7 @@ public: public: leveldb::WriteBatch bat; LevelDBStore *db; - LevelDBTransactionImpl(LevelDBStore *db) : db(db) {} + explicit LevelDBTransactionImpl(LevelDBStore *db) : db(db) {} void set( const string &prefix, const string &k, @@ -220,7 +220,7 @@ public: protected: boost::scoped_ptr dbiter; public: - LevelDBWholeSpaceIteratorImpl(leveldb::Iterator *iter) : + explicit LevelDBWholeSpaceIteratorImpl(leveldb::Iterator *iter) : dbiter(iter) { } virtual ~LevelDBWholeSpaceIteratorImpl() { } diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 80f7fc482891..63be34fd827b 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -35,7 +35,7 @@ using std::string; class CephRocksdbLogger : public rocksdb::Logger { CephContext *cct; public: - CephRocksdbLogger(CephContext *c) : cct(c) { + explicit CephRocksdbLogger(CephContext *c) : cct(c) { cct->get(); } ~CephRocksdbLogger() { diff --git a/src/kv/RocksDBStore.h b/src/kv/RocksDBStore.h index d2caf8aac765..63cbc5ad6c2b 100644 --- a/src/kv/RocksDBStore.h +++ b/src/kv/RocksDBStore.h @@ -72,7 +72,7 @@ class RocksDBStore : public KeyValueDB { class CompactThread : public Thread { RocksDBStore *db; public: - CompactThread(RocksDBStore *d) : db(d) {} + explicit CompactThread(RocksDBStore *d) : db(d) {} void *entry() { db->compact_thread_entry(); return NULL; @@ -142,7 +142,7 @@ public: rocksdb::WriteBatch *bat; RocksDBStore *db; - RocksDBTransactionImpl(RocksDBStore *_db); + explicit RocksDBTransactionImpl(RocksDBStore *_db); ~RocksDBTransactionImpl(); void set( const string &prefix, @@ -179,7 +179,7 @@ public: protected: rocksdb::Iterator *dbiter; public: - RocksDBWholeSpaceIteratorImpl(rocksdb::Iterator *iter) : + explicit RocksDBWholeSpaceIteratorImpl(rocksdb::Iterator *iter) : dbiter(iter) { } //virtual ~RocksDBWholeSpaceIteratorImpl() { } ~RocksDBWholeSpaceIteratorImpl(); diff --git a/src/libcephfs.cc b/src/libcephfs.cc index c5bb2d4d3a00..400669abbaa8 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -37,7 +37,7 @@ struct ceph_mount_info { public: - ceph_mount_info(CephContext *cct_) + explicit ceph_mount_info(CephContext *cct_) : mounted(false), inited(false), client(NULL), diff --git a/src/librados/AioCompletionImpl.h b/src/librados/AioCompletionImpl.h index efcd5962a80b..aaadc1add0f5 100644 --- a/src/librados/AioCompletionImpl.h +++ b/src/librados/AioCompletionImpl.h @@ -170,7 +170,7 @@ namespace librados { struct C_AioComplete : public Context { AioCompletionImpl *c; - C_AioComplete(AioCompletionImpl *cc) : c(cc) { + explicit C_AioComplete(AioCompletionImpl *cc) : c(cc) { c->_get(); } @@ -189,7 +189,7 @@ struct C_AioComplete : public Context { struct C_AioSafe : public Context { AioCompletionImpl *c; - C_AioSafe(AioCompletionImpl *cc) : c(cc) { + explicit C_AioSafe(AioCompletionImpl *cc) : c(cc) { c->_get(); } @@ -216,7 +216,7 @@ struct C_AioSafe : public Context { struct C_AioCompleteAndSafe : public Context { AioCompletionImpl *c; - C_AioCompleteAndSafe(AioCompletionImpl *cc) : c(cc) { + explicit C_AioCompleteAndSafe(AioCompletionImpl *cc) : c(cc) { c->get(); } diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index 24eda4f94377..f3186eceb62f 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -762,7 +762,7 @@ int librados::IoCtxImpl::aio_read(const object_t oid, AioCompletionImpl *c, class C_ObjectOperation : public Context { public: ::ObjectOperation m_ops; - C_ObjectOperation(Context *c) : m_ctx(c) {} + explicit C_ObjectOperation(Context *c) : m_ctx(c) {} virtual void finish(int r) { m_ctx->complete(r); } diff --git a/src/librados/IoCtxImpl.h b/src/librados/IoCtxImpl.h index 25166c01cf55..19faf3341d33 100644 --- a/src/librados/IoCtxImpl.h +++ b/src/librados/IoCtxImpl.h @@ -161,7 +161,7 @@ struct librados::IoCtxImpl { struct C_aio_Ack : public Context { librados::AioCompletionImpl *c; - C_aio_Ack(AioCompletionImpl *_c); + explicit C_aio_Ack(AioCompletionImpl *_c); void finish(int r); }; @@ -175,7 +175,7 @@ struct librados::IoCtxImpl { struct C_aio_Safe : public Context { AioCompletionImpl *c; - C_aio_Safe(AioCompletionImpl *_c); + explicit C_aio_Safe(AioCompletionImpl *_c); void finish(int r); }; diff --git a/src/librados/PoolAsyncCompletionImpl.h b/src/librados/PoolAsyncCompletionImpl.h index 443b2c23a17c..b3fba491b445 100644 --- a/src/librados/PoolAsyncCompletionImpl.h +++ b/src/librados/PoolAsyncCompletionImpl.h @@ -91,7 +91,7 @@ namespace librados { PoolAsyncCompletionImpl *c; public: - C_PoolAsync_Safe(PoolAsyncCompletionImpl *_c) : c(_c) { + explicit C_PoolAsync_Safe(PoolAsyncCompletionImpl *_c) : c(_c) { c->get(); } ~C_PoolAsync_Safe() { diff --git a/src/librados/RadosClient.h b/src/librados/RadosClient.h index a26e46f61fa1..e190bfc90117 100644 --- a/src/librados/RadosClient.h +++ b/src/librados/RadosClient.h @@ -75,7 +75,7 @@ private: public: Finisher finisher; - RadosClient(CephContext *cct_); + explicit RadosClient(CephContext *cct_); ~RadosClient(); int ping_monitor(string mon_id, string *result); int connect(); diff --git a/src/librados/librados.cc b/src/librados/librados.cc index ed256dbc6497..e9038b38e574 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -188,7 +188,7 @@ class ObjectOpCompletionCtx : public Context { librados::ObjectOperationCompletion *completion; bufferlist bl; public: - ObjectOpCompletionCtx(librados::ObjectOperationCompletion *c) : completion(c) {} + explicit ObjectOpCompletionCtx(librados::ObjectOperationCompletion *c) : completion(c) {} void finish(int r) { completion->handle_completion(r, bl); delete completion; @@ -4873,7 +4873,7 @@ struct RadosOmapIter { class C_OmapIter : public Context { RadosOmapIter *iter; public: - C_OmapIter(RadosOmapIter *iter) : iter(iter) {} + explicit C_OmapIter(RadosOmapIter *iter) : iter(iter) {} void finish(int r) { iter->i = iter->values.begin(); } @@ -4882,7 +4882,7 @@ public: class C_XattrsIter : public Context { librados::RadosXattrsIter *iter; public: - C_XattrsIter(librados::RadosXattrsIter *iter) : iter(iter) {} + explicit C_XattrsIter(librados::RadosXattrsIter *iter) : iter(iter) {} void finish(int r) { iter->i = iter->attrset.begin(); } @@ -4924,7 +4924,7 @@ extern "C" void rados_read_op_omap_get_vals(rados_read_op_t read_op, struct C_OmapKeysIter : public Context { RadosOmapIter *iter; std::set keys; - C_OmapKeysIter(RadosOmapIter *iter) : iter(iter) {} + explicit C_OmapKeysIter(RadosOmapIter *iter) : iter(iter) {} void finish(int r) { // map each key to an empty bl for (std::set::const_iterator i = keys.begin(); diff --git a/src/librbd/AsyncOperation.cc b/src/librbd/AsyncOperation.cc index fd315ad75f44..0c79d8ac3ca9 100644 --- a/src/librbd/AsyncOperation.cc +++ b/src/librbd/AsyncOperation.cc @@ -18,7 +18,7 @@ struct C_CompleteFlushes : public Context { ImageCtx *image_ctx; std::list flush_contexts; - C_CompleteFlushes(ImageCtx *image_ctx, std::list &&flush_contexts) + explicit C_CompleteFlushes(ImageCtx *image_ctx, std::list &&flush_contexts) : image_ctx(image_ctx), flush_contexts(std::move(flush_contexts)) { } virtual void finish(int r) { diff --git a/src/librbd/ExclusiveLock.cc b/src/librbd/ExclusiveLock.cc index cef72cceca79..1d0d189eadb6 100644 --- a/src/librbd/ExclusiveLock.cc +++ b/src/librbd/ExclusiveLock.cc @@ -28,7 +28,7 @@ const std::string WATCHER_LOCK_COOKIE_PREFIX = "auto"; template struct C_SendReleaseRequest : public Context { ReleaseRequest* request; - C_SendReleaseRequest(ReleaseRequest* request) : request(request) { + explicit C_SendReleaseRequest(ReleaseRequest* request) : request(request) { } virtual void finish(int r) override { request->send(); diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 7e48e4f34bb9..0961d0e18171 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -48,7 +48,7 @@ namespace { class ThreadPoolSingleton : public ThreadPool { public: - ThreadPoolSingleton(CephContext *cct) + explicit ThreadPoolSingleton(CephContext *cct) : ThreadPool(cct, "librbd::thread_pool", "tp_librbd", cct->_conf->rbd_op_threads, "rbd_op_threads") { start(); diff --git a/src/librbd/LibrbdAdminSocketHook.cc b/src/librbd/LibrbdAdminSocketHook.cc index 1aea29d8be6e..5485ba5d62c5 100644 --- a/src/librbd/LibrbdAdminSocketHook.cc +++ b/src/librbd/LibrbdAdminSocketHook.cc @@ -21,7 +21,7 @@ public: class FlushCacheCommand : public LibrbdAdminSocketCommand { public: - FlushCacheCommand(ImageCtx *ictx) : ictx(ictx) {} + explicit FlushCacheCommand(ImageCtx *ictx) : ictx(ictx) {} bool call(stringstream *ss) { int r = flush(ictx); @@ -38,7 +38,7 @@ private: struct InvalidateCacheCommand : public LibrbdAdminSocketCommand { public: - InvalidateCacheCommand(ImageCtx *ictx) : ictx(ictx) {} + explicit InvalidateCacheCommand(ImageCtx *ictx) : ictx(ictx) {} bool call(stringstream *ss) { int r = invalidate_cache(ictx); diff --git a/src/librbd/WatchNotifyTypes.cc b/src/librbd/WatchNotifyTypes.cc index 93b12ee40dd6..f3a6f4bfe0ff 100644 --- a/src/librbd/WatchNotifyTypes.cc +++ b/src/librbd/WatchNotifyTypes.cc @@ -13,7 +13,7 @@ namespace { class EncodePayloadVisitor : public boost::static_visitor { public: - EncodePayloadVisitor(bufferlist &bl) : m_bl(bl) {} + explicit EncodePayloadVisitor(bufferlist &bl) : m_bl(bl) {} template inline void operator()(const Payload &payload) const { @@ -42,7 +42,7 @@ private: class DumpPayloadVisitor : public boost::static_visitor { public: - DumpPayloadVisitor(Formatter *formatter) : m_formatter(formatter) {} + explicit DumpPayloadVisitor(Formatter *formatter) : m_formatter(formatter) {} template inline void operator()(const Payload &payload) const { diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 0663ea83cba5..928f4049d22c 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -1729,7 +1729,7 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) { } struct CopyProgressCtx { - CopyProgressCtx(ProgressContext &p) + explicit CopyProgressCtx(ProgressContext &p) : destictx(NULL), src_size(0), prog_ctx(p) { } diff --git a/src/librbd/journal/Entries.cc b/src/librbd/journal/Entries.cc index be350afd58a2..5ed5cf3d071f 100644 --- a/src/librbd/journal/Entries.cc +++ b/src/librbd/journal/Entries.cc @@ -21,7 +21,7 @@ public: class EncodeEventVisitor : public boost::static_visitor { public: - EncodeEventVisitor(bufferlist &bl) : m_bl(bl) { + explicit EncodeEventVisitor(bufferlist &bl) : m_bl(bl) { } template @@ -50,7 +50,7 @@ private: class DumpEventVisitor : public boost::static_visitor { public: - DumpEventVisitor(Formatter *formatter) : m_formatter(formatter) {} + explicit DumpEventVisitor(Formatter *formatter) : m_formatter(formatter) {} template inline void operator()(const Event &event) const { diff --git a/src/log/Log.h b/src/log/Log.h index 57727d312bc9..db8b6199a04c 100644 --- a/src/log/Log.h +++ b/src/log/Log.h @@ -51,7 +51,7 @@ class Log : private Thread void _log_message(const char *s, bool crash); public: - Log(SubsystemMap *s); + explicit Log(SubsystemMap *s); virtual ~Log(); void set_flush_on_exit(); diff --git a/src/mds/Beacon.h b/src/mds/Beacon.h index a63daff8bbf3..29efb4ad5866 100644 --- a/src/mds/Beacon.h +++ b/src/mds/Beacon.h @@ -67,7 +67,7 @@ class Beacon : public Dispatcher class C_MDS_BeaconSender : public Context { Beacon *beacon; public: - C_MDS_BeaconSender(Beacon *beacon_) : beacon(beacon_) {} + explicit C_MDS_BeaconSender(Beacon *beacon_) : beacon(beacon_) {} void finish(int r) { assert(beacon->lock.is_locked_by_me()); beacon->sender = NULL; diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 119fb32cca05..f43c768ad60c 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -51,7 +51,7 @@ protected: MDSRank* get_mds() {return dir->cache->mds;} public: - CDirContext(CDir *d) : dir(d) { + explicit CDirContext(CDir *d) : dir(d) { assert(dir != NULL); } }; @@ -64,7 +64,7 @@ protected: MDSRank* get_mds() {return dir->cache->mds;} public: - CDirIOContext(CDir *d) : dir(d) { + explicit CDirIOContext(CDir *d) : dir(d) { assert(dir != NULL); } }; @@ -2714,7 +2714,7 @@ CDir *CDir::get_frozen_tree_root() class C_Dir_AuthUnpin : public CDirContext { public: - C_Dir_AuthUnpin(CDir *d) : CDirContext(d) {} + explicit C_Dir_AuthUnpin(CDir *d) : CDirContext(d) {} void finish(int r) { dir->auth_unpin(dir->get_inode()); } diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index 038de0e7a912..68ebd76a7ae0 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -58,7 +58,7 @@ protected: CInode *in; MDSRank *get_mds() {return in->mdcache->mds;} public: - CInodeIOContext(CInode *in_) : in(in_) { + explicit CInodeIOContext(CInode *in_) : in(in_) { assert(in != NULL); } }; diff --git a/src/mds/InoTable.h b/src/mds/InoTable.h index 02656b0ece72..a767d46587ca 100644 --- a/src/mds/InoTable.h +++ b/src/mds/InoTable.h @@ -26,7 +26,7 @@ class InoTable : public MDSTable { interval_set projected_free; public: - InoTable(MDSRank *m) : MDSTable(m, "inotable", true) { } + explicit InoTable(MDSRank *m) : MDSTable(m, "inotable", true) { } inodeno_t project_alloc_id(inodeno_t id=0); void apply_alloc_id(inodeno_t id); diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index aea88f5b6830..25977fbe26be 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -64,7 +64,7 @@ class LockerContext : public MDSInternalContextBase { } public: - LockerContext(Locker *locker_) : locker(locker_) { + explicit LockerContext(Locker *locker_) : locker(locker_) { assert(locker != NULL); } }; diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h index 26bf2797a515..bf57db00e330 100644 --- a/src/mds/LogEvent.h +++ b/src/mds/LogEvent.h @@ -68,7 +68,7 @@ protected: public: LogSegment *_segment; - LogEvent(int t) + explicit LogEvent(int t) : _type(t), _start_off(0), _segment(0) { } virtual ~LogEvent() { } diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index 263c21ad14e5..4c42568aa260 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -113,7 +113,7 @@ void MDBalancer::tick() class C_Bal_SendHeartbeat : public MDSInternalContext { public: - C_Bal_SendHeartbeat(MDSRank *mds_) : MDSInternalContext(mds_) { } + explicit C_Bal_SendHeartbeat(MDSRank *mds_) : MDSInternalContext(mds_) { } virtual void finish(int f) { mds->balancer->send_heartbeat(); } diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index d63da01cdeaf..0441f84e120f 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -143,7 +143,7 @@ protected: return mdcache->mds; } public: - MDCacheContext(MDCache *mdc_) : mdcache(mdc_) {} + explicit MDCacheContext(MDCache *mdc_) : mdcache(mdc_) {} }; @@ -163,7 +163,7 @@ protected: return mdcache->mds; } public: - MDCacheIOContext(MDCache *mdc_) : mdcache(mdc_) {} + explicit MDCacheIOContext(MDCache *mdc_) : mdcache(mdc_) {} }; @@ -574,7 +574,7 @@ void MDCache::_create_system_file_finish(MutationRef& mut, CDentry *dn, version_ struct C_MDS_RetryOpenRoot : public MDSInternalContext { MDCache *cache; - C_MDS_RetryOpenRoot(MDCache *c) : MDSInternalContext(c->mds), cache(c) {} + explicit C_MDS_RetryOpenRoot(MDCache *c) : MDSInternalContext(c->mds), cache(c) {} void finish(int r) { if (r < 0) cache->mds->suicide(); @@ -4475,7 +4475,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) class C_MDC_RejoinGatherFinish : public MDCacheContext { public: - C_MDC_RejoinGatherFinish(MDCache *c) : MDCacheContext(c) {} + explicit C_MDC_RejoinGatherFinish(MDCache *c) : MDCacheContext(c) {} void finish(int r) { mdcache->rejoin_gather_finish(); } @@ -5633,7 +5633,7 @@ void MDCache::do_delayed_cap_imports() } struct C_MDC_OpenSnapParents : public MDCacheContext { - C_MDC_OpenSnapParents(MDCache *c) : MDCacheContext(c) {} + explicit C_MDC_OpenSnapParents(MDCache *c) : MDCacheContext(c) {} void finish(int r) { mdcache->open_snap_parents(); } @@ -7251,7 +7251,7 @@ void MDCache::check_memory_usage() class C_MDC_ShutdownCheck : public MDCacheContext { public: - C_MDC_ShutdownCheck(MDCache *m) : MDCacheContext(m) {} + explicit C_MDC_ShutdownCheck(MDCache *m) : MDCacheContext(m) {} void finish(int) { mdcache->shutdown_check(); } diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 1a7f89691f8e..3b44d0c7f672 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -629,7 +629,7 @@ public: Migrator *migrator; public: - MDCache(MDSRank *m); + explicit MDCache(MDSRank *m); ~MDCache(); // debug diff --git a/src/mds/MDLog.cc b/src/mds/MDLog.cc index bc27661df923..86a194578591 100644 --- a/src/mds/MDLog.cc +++ b/src/mds/MDLog.cc @@ -104,7 +104,7 @@ class C_MDL_WriteError : public MDSIOContextBase { } public: - C_MDL_WriteError(MDLog *m) : mdlog(m) {} + explicit C_MDL_WriteError(MDLog *m) : mdlog(m) {} }; diff --git a/src/mds/MDLog.h b/src/mds/MDLog.h index 558f7231c1ab..663eac6dc0f0 100644 --- a/src/mds/MDLog.h +++ b/src/mds/MDLog.h @@ -87,7 +87,7 @@ protected: class ReplayThread : public Thread { MDLog *log; public: - ReplayThread(MDLog *l) : log(l) {} + explicit ReplayThread(MDLog *l) : log(l) {} void* entry() { log->_replay_thread(); return 0; @@ -109,7 +109,7 @@ protected: MDSInternalContextBase *completion; public: void set_completion(MDSInternalContextBase *c) {completion = c;} - RecoveryThread(MDLog *l) : log(l), completion(NULL) {} + explicit RecoveryThread(MDLog *l) : log(l), completion(NULL) {} void* entry() { log->_recovery_thread(completion); return 0; @@ -141,7 +141,7 @@ protected: class SubmitThread : public Thread { MDLog *log; public: - SubmitThread(MDLog *l) : log(l) {} + explicit SubmitThread(MDLog *l) : log(l) {} void* entry() { log->_submit_thread(); return 0; @@ -182,7 +182,7 @@ public: void set_write_iohint(unsigned iohint_flags); public: - MDLog(MDSRank *m) : mds(m), + explicit MDLog(MDSRank *m) : mds(m), num_events(0), unflushed(0), capped(false), diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h index ccf2857b70bf..eee7707fe03c 100644 --- a/src/mds/MDSAuthCaps.h +++ b/src/mds/MDSAuthCaps.h @@ -74,7 +74,7 @@ struct MDSCapMatch { MDSCapMatch() : uid(MDS_AUTH_UID_ANY) {} MDSCapMatch(int64_t uid_, std::vector& gids_) : uid(uid_), gids(gids_) {} - MDSCapMatch(std::string path_) + explicit MDSCapMatch(std::string path_) : uid(MDS_AUTH_UID_ANY), path(path_) { normalize_path(); } @@ -119,11 +119,11 @@ class MDSAuthCaps std::vector grants; public: - MDSAuthCaps(CephContext *cct_=NULL) + explicit MDSAuthCaps(CephContext *cct_=NULL) : cct(cct_) { } // this ctor is used by spirit/phoenix; doesn't need cct. - MDSAuthCaps(const std::vector &grants_) + explicit MDSAuthCaps(const std::vector &grants_) : cct(NULL), grants(grants_) { } void set_allow_all(); diff --git a/src/mds/MDSContext.h b/src/mds/MDSContext.h index cd49f3e55f19..d26d1bdb783a 100644 --- a/src/mds/MDSContext.h +++ b/src/mds/MDSContext.h @@ -55,7 +55,7 @@ protected: virtual MDSRank* get_mds(); public: - MDSInternalContext(MDSRank *mds_) : mds(mds_) { + explicit MDSInternalContext(MDSRank *mds_) : mds(mds_) { assert(mds != NULL); } }; @@ -91,7 +91,7 @@ protected: virtual MDSRank* get_mds(); public: - MDSIOContext(MDSRank *mds_) : mds(mds_) { + explicit MDSIOContext(MDSRank *mds_) : mds(mds_) { assert(mds != NULL); } }; diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 8873ca5a3346..c5f0a8db6f5b 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -153,7 +153,7 @@ MDSDaemon::~MDSDaemon() { class MDSSocketHook : public AdminSocketHook { MDSDaemon *mds; public: - MDSSocketHook(MDSDaemon *m) : mds(m) {} + explicit MDSSocketHook(MDSDaemon *m) : mds(m) {} bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& out) { stringstream ss; @@ -700,7 +700,7 @@ int MDSDaemon::_handle_command( MDSDaemon *mds; public: - SuicideLater(MDSDaemon *mds_) : mds(mds_) {} + explicit SuicideLater(MDSDaemon *mds_) : mds(mds_) {} void finish(int r) { // Wait a little to improve chances of caller getting // our response before seeing us disappear from mdsmap @@ -717,7 +717,7 @@ int MDSDaemon::_handle_command( public: - RespawnLater(MDSDaemon *mds_) : mds(mds_) {} + explicit RespawnLater(MDSDaemon *mds_) : mds(mds_) {} void finish(int r) { // Wait a little to improve chances of caller getting // our response before seeing us disappear from mdsmap diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index 8c61ea9ca4ba..783f37e348fb 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -130,7 +130,7 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t { protected: MDSDaemon *mds_daemon; public: - C_MDS_Tick(MDSDaemon *m) : mds_daemon(m) {} + explicit C_MDS_Tick(MDSDaemon *m) : mds_daemon(m) {} void finish(int r) { assert(mds_daemon->mds_lock.is_locked_by_me()); diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 943020bc79d0..6b8e2bb3a0f8 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1080,7 +1080,7 @@ inline void MDSRank::standby_replay_restart() class MDSRank::C_MDS_StandbyReplayRestart : public MDSInternalContext { public: - C_MDS_StandbyReplayRestart(MDSRank *m) : MDSInternalContext(m) {} + explicit C_MDS_StandbyReplayRestart(MDSRank *m) : MDSInternalContext(m) {} void finish(int r) { assert(!r); mds->standby_replay_restart(); diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index 5d334a216241..a11f3b943eac 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -205,7 +205,7 @@ class MDSRank { MDSRank *mds; Cond cond; public: - ProgressThread(MDSRank *mds_) : mds(mds_) {} + explicit ProgressThread(MDSRank *mds_) : mds(mds_) {} void * entry(); void shutdown(); void signal() {cond.Signal();} diff --git a/src/mds/MDSTable.cc b/src/mds/MDSTable.cc index 5ff0dd0d9258..083eae9960c0 100644 --- a/src/mds/MDSTable.cc +++ b/src/mds/MDSTable.cc @@ -39,7 +39,7 @@ class MDSTableIOContext : public MDSIOContextBase MDSTable *ida; MDSRank *get_mds() {return ida->mds;} public: - MDSTableIOContext(MDSTable *ida_) : ida(ida_) { + explicit MDSTableIOContext(MDSTable *ida_) : ida(ida_) { assert(ida != NULL); } }; diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index d807fb628840..4dce94fafff1 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -90,7 +90,7 @@ protected: return mig->mds; } public: - MigratorContext(Migrator *mig_) : mig(mig_) { + explicit MigratorContext(Migrator *mig_) : mig(mig_) { assert(mig != NULL); } }; diff --git a/src/mds/RecoveryQueue.h b/src/mds/RecoveryQueue.h index c0e2f7af1b1b..6750c5fcb495 100644 --- a/src/mds/RecoveryQueue.h +++ b/src/mds/RecoveryQueue.h @@ -30,7 +30,7 @@ public: void enqueue(CInode *in); void advance(); void prioritize(CInode *in); ///< do this inode now/soon - RecoveryQueue(MDSRank *mds_); + explicit RecoveryQueue(MDSRank *mds_); void set_logger(PerfCounters *p) {logger=p;} diff --git a/src/mds/ScatterLock.h b/src/mds/ScatterLock.h index c490b446a822..78bd474a2c82 100644 --- a/src/mds/ScatterLock.h +++ b/src/mds/ScatterLock.h @@ -26,7 +26,7 @@ class ScatterLock : public SimpleLock { xlist::item item_updated; utime_t update_stamp; - more_bits_t(ScatterLock *lock) : + explicit more_bits_t(ScatterLock *lock) : state_flags(0), item_updated(lock) {} diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 46c08bd37c4d..fd764cab5b60 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -80,7 +80,7 @@ class ServerContext : public MDSInternalContextBase { } public: - ServerContext(Server *s) : server(s) { + explicit ServerContext(Server *s) : server(s) { assert(server != NULL); } }; @@ -558,7 +558,7 @@ class C_MDS_TerminatedSessions : public ServerContext { server->terminating_sessions = false; } public: - C_MDS_TerminatedSessions(Server *s) : ServerContext(s) {} + explicit C_MDS_TerminatedSessions(Server *s) : ServerContext(s) {} }; void Server::terminate_sessions() diff --git a/src/mds/Server.h b/src/mds/Server.h index 44ee5b782ea6..d194a2f0574e 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -63,7 +63,7 @@ private: public: bool terminating_sessions; - Server(MDSRank *m); + explicit Server(MDSRank *m); ~Server() { g_ceph_context->get_perfcounters_collection()->remove(logger); delete logger; diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index 4552e5e91e9b..9b4bc7fa2bec 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -35,7 +35,7 @@ class SessionMapIOContext : public MDSIOContextBase SessionMap *sessionmap; MDSRank *get_mds() {return sessionmap->mds;} public: - SessionMapIOContext(SessionMap *sessionmap_) : sessionmap(sessionmap_) { + explicit SessionMapIOContext(SessionMap *sessionmap_) : sessionmap(sessionmap_) { assert(sessionmap != NULL); } }; @@ -253,7 +253,7 @@ void SessionMap::load(MDSInternalContextBase *onload) class C_IO_SM_LoadLegacy : public SessionMapIOContext { public: bufferlist bl; - C_IO_SM_LoadLegacy(SessionMap *cm) : SessionMapIOContext(cm) {} + explicit C_IO_SM_LoadLegacy(SessionMap *cm) : SessionMapIOContext(cm) {} void finish(int r) { sessionmap->_load_legacy_finish(r, bl); } diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index b6a379270754..75a7d0704e55 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -428,7 +428,7 @@ public: uint64_t set_state(Session *session, int state); map > commit_waiters; - SessionMap(MDSRank *m) : mds(m), + explicit SessionMap(MDSRank *m) : mds(m), projected(0), committing(0), committed(0), loaded_legacy(false) { } diff --git a/src/mds/SimpleLock.h b/src/mds/SimpleLock.h index 085aec7f7b61..faec26ad5a47 100644 --- a/src/mds/SimpleLock.h +++ b/src/mds/SimpleLock.h @@ -58,7 +58,7 @@ struct LockType { int type; const sm_t *sm; - LockType(int t) : type(t) { + explicit LockType(int t) : type(t) { switch (type) { case CEPH_LOCK_DN: case CEPH_LOCK_IAUTH: diff --git a/src/mds/SnapClient.h b/src/mds/SnapClient.h index 883699f26448..800538c8b136 100644 --- a/src/mds/SnapClient.h +++ b/src/mds/SnapClient.h @@ -24,7 +24,7 @@ class LogSegment; class SnapClient : public MDSTableClient { public: - SnapClient(MDSRank *m) : MDSTableClient(m, TABLE_SNAP) {} + explicit SnapClient(MDSRank *m) : MDSTableClient(m, TABLE_SNAP) {} void resend_queries() {} void handle_query_result(MMDSTableRequest *m) {} diff --git a/src/mds/StrayManager.cc b/src/mds/StrayManager.cc index da1a2fe2ce37..6c30b33e5539 100644 --- a/src/mds/StrayManager.cc +++ b/src/mds/StrayManager.cc @@ -42,7 +42,7 @@ protected: return sm->mds; } public: - StrayManagerIOContext(StrayManager *sm_) : sm(sm_) {} + explicit StrayManagerIOContext(StrayManager *sm_) : sm(sm_) {} }; @@ -54,7 +54,7 @@ protected: return sm->mds; } public: - StrayManagerContext(StrayManager *sm_) : sm(sm_) {} + explicit StrayManagerContext(StrayManager *sm_) : sm(sm_) {} }; diff --git a/src/mds/StrayManager.h b/src/mds/StrayManager.h index c62edd3e1b65..3576889ef892 100644 --- a/src/mds/StrayManager.h +++ b/src/mds/StrayManager.h @@ -150,7 +150,7 @@ class StrayManager // My public interface is for consumption by MDCache public: - StrayManager(MDSRank *mds); + explicit StrayManager(MDSRank *mds); void set_logger(PerfCounters *l) {logger = l;} bool eval_stray(CDentry *dn, bool delay=false); diff --git a/src/mds/events/ECommitted.h b/src/mds/events/ECommitted.h index 48de756f7ae8..4cdbbfbe44ff 100644 --- a/src/mds/events/ECommitted.h +++ b/src/mds/events/ECommitted.h @@ -23,7 +23,7 @@ public: metareqid_t reqid; ECommitted() : LogEvent(EVENT_COMMITTED) { } - ECommitted(metareqid_t r) : + explicit ECommitted(metareqid_t r) : LogEvent(EVENT_COMMITTED), reqid(r) { } void print(ostream& out) const { diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h index 7d219e936391..8db8f6738c59 100644 --- a/src/mds/events/EMetaBlob.h +++ b/src/mds/events/EMetaBlob.h @@ -94,7 +94,7 @@ public: old_inodes = *oi; snapbl = sbl; } - fullbit(bufferlist::iterator &p) { + explicit fullbit(bufferlist::iterator &p) { decode(p); } fullbit() {} @@ -144,7 +144,7 @@ public: remotebit(const string& d, snapid_t df, snapid_t dl, version_t v, inodeno_t i, unsigned char dt, bool dr) : dn(d), dnfirst(df), dnlast(dl), dnv(v), ino(i), d_type(dt), dirty(dr) { } - remotebit(bufferlist::iterator &p) { decode(p); } + explicit remotebit(bufferlist::iterator &p) { decode(p); } remotebit(): dnfirst(0), dnlast(0), dnv(0), ino(0), d_type('\0'), dirty(false) {} @@ -171,7 +171,7 @@ public: nullbit(const string& d, snapid_t df, snapid_t dl, version_t v, bool dr) : dn(d), dnfirst(df), dnlast(dl), dnv(v), dirty(dr) { } - nullbit(bufferlist::iterator &p) { decode(p); } + explicit nullbit(bufferlist::iterator &p) { decode(p); } nullbit(): dnfirst(0), dnlast(0), dnv(0), dirty(false) {} void encode(bufferlist& bl) const; @@ -333,7 +333,7 @@ private: // for replay, in certain cases //LogSegment *_segment; - EMetaBlob(MDLog *mdl = 0); // defined in journal.cc + explicit EMetaBlob(MDLog *mdl = 0); // defined in journal.cc ~EMetaBlob() { } void print(ostream& out) { diff --git a/src/mds/events/ENoOp.h b/src/mds/events/ENoOp.h index 9a585c2d22f0..ed825c6b8d4c 100644 --- a/src/mds/events/ENoOp.h +++ b/src/mds/events/ENoOp.h @@ -22,7 +22,7 @@ class ENoOp : public LogEvent { public: ENoOp() : LogEvent(EVENT_NOOP), pad_size(0) { } - ENoOp(uint32_t size_) : LogEvent(EVENT_NOOP), pad_size(size_){ } + explicit ENoOp(uint32_t size_) : LogEvent(EVENT_NOOP), pad_size(size_){ } void encode(bufferlist& bl) const; void decode(bufferlist::iterator& bl); diff --git a/src/mds/events/EOpen.h b/src/mds/events/EOpen.h index c22a58510e59..0c1175baf1a6 100644 --- a/src/mds/events/EOpen.h +++ b/src/mds/events/EOpen.h @@ -24,7 +24,7 @@ public: vector inos; EOpen() : LogEvent(EVENT_OPEN) { } - EOpen(MDLog *mdlog) : + explicit EOpen(MDLog *mdlog) : LogEvent(EVENT_OPEN), metablob(mdlog) { } void print(ostream& out) const { diff --git a/src/mds/flock.h b/src/mds/flock.h index 37149eb7c435..55ba2b8367fe 100644 --- a/src/mds/flock.h +++ b/src/mds/flock.h @@ -39,7 +39,7 @@ inline bool operator==(ceph_filelock& l, ceph_filelock& r) { class ceph_lock_state_t { CephContext *cct; public: - ceph_lock_state_t(CephContext *cct_) : cct(cct_) {} + explicit ceph_lock_state_t(CephContext *cct_) : cct(cct_) {} multimap held_locks; // current locks multimap waiting_locks; // locks waiting for other locks // both of the above are keyed by starting offset diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 669e8b9a702d..4e1b926d5558 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -980,7 +980,7 @@ class inode_load_vec_t { static const int NUM = 2; std::vector < DecayCounter > vec; public: - inode_load_vec_t(const utime_t &now) + explicit inode_load_vec_t(const utime_t &now) : vec(NUM, DecayCounter(now)) {} // for dencoder infrastructure @@ -1011,7 +1011,7 @@ class dirfrag_load_vec_t { public: static const int NUM = 5; std::vector < DecayCounter > vec; - dirfrag_load_vec_t(const utime_t &now) + explicit dirfrag_load_vec_t(const utime_t &now) : vec(NUM, DecayCounter(now)) { } // for dencoder infrastructure @@ -1115,7 +1115,7 @@ struct mds_load_t { double cpu_load_avg; - mds_load_t(const utime_t &t) : + explicit mds_load_t(const utime_t &t) : auth(t), all(t), req_rate(0), cache_hit_rate(0), queue_len(0), cpu_load_avg(0) {} @@ -1227,7 +1227,7 @@ struct ClientLease { // print hack struct mdsco_db_line_prefix { MDSCacheObject *object; - mdsco_db_line_prefix(MDSCacheObject *o) : object(o) {} + explicit mdsco_db_line_prefix(MDSCacheObject *o) : object(o) {} }; std::ostream& operator<<(std::ostream& out, mdsco_db_line_prefix o); diff --git a/src/messages/MMonMap.h b/src/messages/MMonMap.h index 3e950fa6f639..808a7572d9ca 100644 --- a/src/messages/MMonMap.h +++ b/src/messages/MMonMap.h @@ -24,7 +24,7 @@ public: bufferlist monmapbl; MMonMap() : Message(CEPH_MSG_MON_MAP) { } - MMonMap(bufferlist &bl) : Message(CEPH_MSG_MON_MAP) { + explicit MMonMap(bufferlist &bl) : Message(CEPH_MSG_MON_MAP) { monmapbl.claim(bl); } private: diff --git a/src/mon/Elector.h b/src/mon/Elector.h index ab84d0bf878a..03a9d17d9b27 100644 --- a/src/mon/Elector.h +++ b/src/mon/Elector.h @@ -169,7 +169,7 @@ class Elector { class C_ElectionExpire : public Context { Elector *elector; public: - C_ElectionExpire(Elector *e) : elector(e) { } + explicit C_ElectionExpire(Elector *e) : elector(e) { } void finish(int r) { elector->expire(); } @@ -348,7 +348,7 @@ class Elector { * * @param m A Monitor instance */ - Elector(Monitor *m) : mon(m), + explicit Elector(Monitor *m) : mon(m), expire_event(0), epoch(0), participating(true), diff --git a/src/mon/MonCap.h b/src/mon/MonCap.h index 7dba641e703c..400a4bbbe3ec 100644 --- a/src/mon/MonCap.h +++ b/src/mon/MonCap.h @@ -118,7 +118,7 @@ struct MonCap { std::vector grants; MonCap() {} - MonCap(std::vector g) : grants(g) {} + explicit MonCap(std::vector g) : grants(g) {} string get_str() const { return text; diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index c3efd78f8666..d98a15b61aab 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -155,7 +155,7 @@ private: struct C_Tick : public Context { MonClient *monc; - C_Tick(MonClient *m) : monc(m) {} + explicit C_Tick(MonClient *m) : monc(m) {} void finish(int r) { monc->tick(); } @@ -300,7 +300,7 @@ public: RotatingKeyRing *rotating_secrets; public: - MonClient(CephContext *cct_); + explicit MonClient(CephContext *cct_); ~MonClient(); int init(); @@ -406,7 +406,7 @@ private: int *prval; Context *onfinish, *ontimeout; - MonCommand(uint64_t t) + explicit MonCommand(uint64_t t) : target_rank(-1), tid(t), poutbl(NULL), prs(NULL), prval(NULL), onfinish(NULL), ontimeout(NULL) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1cacc5d7f1fa..267fd6e5783c 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -266,7 +266,7 @@ Monitor::~Monitor() class AdminHook : public AdminSocketHook { Monitor *mon; public: - AdminHook(Monitor *m) : mon(m) {} + explicit AdminHook(Monitor *m) : mon(m) {} bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& out) { stringstream ss; @@ -3091,7 +3091,7 @@ void Monitor::forward_request_leader(MonOpRequestRef op) // fake connection attached to forwarded messages struct AnonConnection : public Connection { - AnonConnection(CephContext *cct) : Connection(cct, NULL) {} + explicit AnonConnection(CephContext *cct) : Connection(cct, NULL) {} int send_message(Message *m) override { assert(!"send_message on anonymous connection"); @@ -4692,7 +4692,7 @@ void Monitor::scrub_reset_timeout() class C_Mon_Tick : public Context { Monitor *mon; public: - C_Mon_Tick(Monitor *m) : mon(m) {} + explicit C_Mon_Tick(Monitor *m) : mon(m) {} void finish(int r) { mon->tick(); } diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 9c2ced0d5ea1..d506ebad3643 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -260,14 +260,14 @@ private: struct C_Scrub : public Context { Monitor *mon; - C_Scrub(Monitor *m) : mon(m) { } + explicit C_Scrub(Monitor *m) : mon(m) { } void finish(int r) { mon->scrub_start(); } }; struct C_ScrubTimeout : public Context { Monitor *mon; - C_ScrubTimeout(Monitor *m) : mon(m) { } + explicit C_ScrubTimeout(Monitor *m) : mon(m) { } void finish(int r) { mon->scrub_timeout(); } @@ -351,7 +351,7 @@ private: struct C_SyncTimeout : public Context { Monitor *mon; - C_SyncTimeout(Monitor *m) : mon(m) {} + explicit C_SyncTimeout(Monitor *m) : mon(m) {} void finish(int r) { mon->sync_timeout(); } @@ -509,7 +509,7 @@ private: struct C_TimeCheck : public Context { Monitor *mon; - C_TimeCheck(Monitor *m) : mon(m) { } + explicit C_TimeCheck(Monitor *m) : mon(m) { } void finish(int r) { mon->timecheck_start_round(); } @@ -565,7 +565,7 @@ private: struct C_ProbeTimeout : public Context { Monitor *mon; - C_ProbeTimeout(Monitor *m) : mon(m) {} + explicit C_ProbeTimeout(Monitor *m) : mon(m) {} void finish(int r) { mon->probe_timeout(r); } @@ -714,7 +714,7 @@ public: struct C_HealthToClogTick : public Context { Monitor *mon; - C_HealthToClogTick(Monitor *m) : mon(m) { } + explicit C_HealthToClogTick(Monitor *m) : mon(m) { } void finish(int r) { if (r < 0) return; @@ -725,7 +725,7 @@ public: struct C_HealthToClogInterval : public Context { Monitor *mon; - C_HealthToClogInterval(Monitor *m) : mon(m) { } + explicit C_HealthToClogInterval(Monitor *m) : mon(m) { } void finish(int r) { if (r < 0) return; diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index 082e1712dde9..cbb0b33ed9b7 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -621,7 +621,7 @@ class MonitorDBStore return db->get_estimated_size(extras); } - MonitorDBStore(const string& path) + explicit MonitorDBStore(const string& path) : db(0), do_dump(false), dump_fd_binary(-1), diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index df6e38840d88..42c58a0111ad 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -781,7 +781,7 @@ public: protected: struct lowprecision_t { float v; - lowprecision_t(float _v) : v(_v) {} + explicit lowprecision_t(float _v) : v(_v) {} }; friend std::ostream &operator<<(ostream& out, const lowprecision_t& v); diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 36d6ae7b8102..3e50daeef8d8 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -55,7 +55,7 @@ struct failure_reporter_t { MonOpRequestRef op; ///< failure op request failure_reporter_t() {} - failure_reporter_t(utime_t s) : failed_since(s) {} + explicit failure_reporter_t(utime_t s) : failed_since(s) {} ~failure_reporter_t() { } }; diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index dfab30af7d8a..52b0bda43c36 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -809,7 +809,7 @@ void Paxos::accept_timeout() struct C_Committed : public Context { Paxos *paxos; - C_Committed(Paxos *p) : paxos(p) {} + explicit C_Committed(Paxos *p) : paxos(p) {} void finish(int r) { assert(r >= 0); Mutex::Locker l(paxos->mon->lock); diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index 4f570275d5dc..052cd76aea0d 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -629,7 +629,7 @@ private: class C_CollectTimeout : public Context { Paxos *paxos; public: - C_CollectTimeout(Paxos *p) : paxos(p) {} + explicit C_CollectTimeout(Paxos *p) : paxos(p) {} void finish(int r) { if (r == -ECANCELED) return; @@ -643,7 +643,7 @@ private: class C_AcceptTimeout : public Context { Paxos *paxos; public: - C_AcceptTimeout(Paxos *p) : paxos(p) {} + explicit C_AcceptTimeout(Paxos *p) : paxos(p) {} void finish(int r) { if (r == -ECANCELED) return; @@ -657,7 +657,7 @@ private: class C_LeaseAckTimeout : public Context { Paxos *paxos; public: - C_LeaseAckTimeout(Paxos *p) : paxos(p) {} + explicit C_LeaseAckTimeout(Paxos *p) : paxos(p) {} void finish(int r) { if (r == -ECANCELED) return; @@ -671,7 +671,7 @@ private: class C_LeaseTimeout : public Context { Paxos *paxos; public: - C_LeaseTimeout(Paxos *p) : paxos(p) {} + explicit C_LeaseTimeout(Paxos *p) : paxos(p) {} void finish(int r) { if (r == -ECANCELED) return; @@ -685,7 +685,7 @@ private: class C_LeaseRenew : public Context { Paxos *paxos; public: - C_LeaseRenew(Paxos *p) : paxos(p) {} + explicit C_LeaseRenew(Paxos *p) : paxos(p) {} void finish(int r) { if (r == -ECANCELED) return; @@ -696,7 +696,7 @@ private: class C_Trimmed : public Context { Paxos *paxos; public: - C_Trimmed(Paxos *p) : paxos(p) { } + explicit C_Trimmed(Paxos *p) : paxos(p) { } void finish(int r) { paxos->trimming = false; } diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 5ede65470435..77c62253dbf2 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -128,7 +128,7 @@ protected: class C_Active : public Context { PaxosService *svc; public: - C_Active(PaxosService *s) : svc(s) {} + explicit C_Active(PaxosService *s) : svc(s) {} void finish(int r) { if (r >= 0) svc->_active(); @@ -142,7 +142,7 @@ protected: class C_Propose : public Context { PaxosService *ps; public: - C_Propose(PaxosService *p) : ps(p) { } + explicit C_Propose(PaxosService *p) : ps(p) { } void finish(int r) { ps->proposal_timer = 0; if (r >= 0) @@ -167,7 +167,7 @@ protected: class C_Committed : public Context { PaxosService *ps; public: - C_Committed(PaxosService *p) : ps(p) { } + explicit C_Committed(PaxosService *p) : ps(p) { } void finish(int r) { ps->proposing = false; if (r >= 0) diff --git a/src/mon/mon_types.h b/src/mon/mon_types.h index a720075dae78..08dd11f58b2c 100644 --- a/src/mon/mon_types.h +++ b/src/mon/mon_types.h @@ -212,7 +212,7 @@ struct C_MonOp : public Context { MonOpRequestRef op; - C_MonOp(MonOpRequestRef o) : + explicit C_MonOp(MonOpRequestRef o) : op(o) { } void finish(int r) { diff --git a/src/msg/Dispatcher.h b/src/msg/Dispatcher.h index d6868edc18d9..80e4db4dd2c4 100644 --- a/src/msg/Dispatcher.h +++ b/src/msg/Dispatcher.h @@ -28,7 +28,7 @@ class CephContext; class Dispatcher { public: - Dispatcher(CephContext *cct_) + explicit Dispatcher(CephContext *cct_) : cct(cct_) { } diff --git a/src/msg/Message.h b/src/msg/Message.h index 9eddce1bfa74..a79dbaa23bb3 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -231,7 +231,7 @@ public: Message *m; friend class Message; public: - CompletionHook(Message *_m) : m(_m) {} + explicit CompletionHook(Message *_m) : m(_m) {} virtual void set_message(Message *_m) { m = _m; } }; diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 9c1b250fbcba..89caaa23a7e9 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -50,7 +50,7 @@ class C_time_wakeup : public EventCallback { AsyncConnectionRef conn; public: - C_time_wakeup(AsyncConnectionRef c): conn(c) {} + explicit C_time_wakeup(AsyncConnectionRef c): conn(c) {} void do_request(int fd_or_id) { conn->wakeup_from(fd_or_id); } @@ -60,7 +60,7 @@ class C_handle_read : public EventCallback { AsyncConnectionRef conn; public: - C_handle_read(AsyncConnectionRef c): conn(c) {} + explicit C_handle_read(AsyncConnectionRef c): conn(c) {} void do_request(int fd_or_id) { conn->process(); } @@ -70,7 +70,7 @@ class C_handle_write : public EventCallback { AsyncConnectionRef conn; public: - C_handle_write(AsyncConnectionRef c): conn(c) {} + explicit C_handle_write(AsyncConnectionRef c): conn(c) {} void do_request(int fd) { conn->handle_write(); } @@ -136,7 +136,7 @@ class C_deliver_accept : public EventCallback { class C_local_deliver : public EventCallback { AsyncConnectionRef conn; public: - C_local_deliver(AsyncConnectionRef c): conn(c) {} + explicit C_local_deliver(AsyncConnectionRef c): conn(c) {} void do_request(int id) { conn->local_deliver(); } @@ -146,7 +146,7 @@ class C_local_deliver : public EventCallback { class C_clean_handler : public EventCallback { AsyncConnectionRef conn; public: - C_clean_handler(AsyncConnectionRef c): conn(c) {} + explicit C_clean_handler(AsyncConnectionRef c): conn(c) {} void do_request(int id) { conn->cleanup_handler(); delete this; diff --git a/src/msg/async/AsyncMessenger.h b/src/msg/async/AsyncMessenger.h index 5206a81f7767..f1a07fd8d41e 100644 --- a/src/msg/async/AsyncMessenger.h +++ b/src/msg/async/AsyncMessenger.h @@ -109,7 +109,7 @@ class Processor { Processor *pro; public: - C_processor_accept(Processor *p): pro(p) {} + explicit C_processor_accept(Processor *p): pro(p) {} void do_request(int id) { pro->accept(); } @@ -143,7 +143,7 @@ class WorkerPool { class C_barrier : public EventCallback { WorkerPool *pool; public: - C_barrier(WorkerPool *p): pool(p) {} + explicit C_barrier(WorkerPool *p): pool(p) {} void do_request(int id) { Mutex::Locker l(pool->barrier_lock); pool->barrier_count.dec(); @@ -153,7 +153,7 @@ class WorkerPool { }; friend class C_barrier; public: - WorkerPool(CephContext *c); + explicit WorkerPool(CephContext *c); virtual ~WorkerPool(); void start(); Worker *get_worker() { @@ -332,7 +332,7 @@ private: AsyncMessenger *msgr; public: - C_handle_reap(AsyncMessenger *m): msgr(m) {} + explicit C_handle_reap(AsyncMessenger *m): msgr(m) {} void do_request(int id) { // judge whether is a time event msgr->reap_dead(); diff --git a/src/msg/async/Event.h b/src/msg/async/Event.h index 2575130305b0..fd6f2098472a 100644 --- a/src/msg/async/Event.h +++ b/src/msg/async/Event.h @@ -127,7 +127,7 @@ class EventCenter { public: atomic_t already_wakeup; - EventCenter(CephContext *c): + explicit EventCenter(CephContext *c): cct(c), nevent(0), external_lock("AsyncMessenger::external_lock"), file_lock("AsyncMessenger::file_lock"), diff --git a/src/msg/async/EventEpoll.h b/src/msg/async/EventEpoll.h index 7f01488feaf2..c9e5d5cd9b54 100644 --- a/src/msg/async/EventEpoll.h +++ b/src/msg/async/EventEpoll.h @@ -29,7 +29,7 @@ class EpollDriver : public EventDriver { int size; public: - EpollDriver(CephContext *c): epfd(-1), events(NULL), cct(c), size(0) {} + explicit EpollDriver(CephContext *c): epfd(-1), events(NULL), cct(c), size(0) {} virtual ~EpollDriver() { if (epfd != -1) close(epfd); diff --git a/src/msg/async/EventKqueue.h b/src/msg/async/EventKqueue.h index c7f99a73de6d..8fb53dd69849 100644 --- a/src/msg/async/EventKqueue.h +++ b/src/msg/async/EventKqueue.h @@ -30,7 +30,7 @@ class KqueueDriver : public EventDriver { int size; public: - KqueueDriver(CephContext *c): kqfd(-1), events(NULL), cct(c), size(0) {} + explicit KqueueDriver(CephContext *c): kqfd(-1), events(NULL), cct(c), size(0) {} virtual ~KqueueDriver() { if (kqfd != -1) close(kqfd); diff --git a/src/msg/async/EventSelect.h b/src/msg/async/EventSelect.h index 96ec3229ed96..7cf42ffbe3dd 100644 --- a/src/msg/async/EventSelect.h +++ b/src/msg/async/EventSelect.h @@ -31,7 +31,7 @@ class SelectDriver : public EventDriver { CephContext *cct; public: - SelectDriver(CephContext *c): max_fd(0), cct(c) {} + explicit SelectDriver(CephContext *c): max_fd(0), cct(c) {} virtual ~SelectDriver() {} int init(int nevent); diff --git a/src/msg/async/net_handler.h b/src/msg/async/net_handler.h index 64423dc5bf36..980e009f7b86 100644 --- a/src/msg/async/net_handler.h +++ b/src/msg/async/net_handler.h @@ -26,7 +26,7 @@ namespace ceph { CephContext *cct; public: - NetHandler(CephContext *c): cct(c) {} + explicit NetHandler(CephContext *c): cct(c) {} int set_nonblock(int sd); void set_socket_options(int sd); int connect(const entity_addr_t &addr); diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h index 8f98b88eb926..55a865b7454b 100644 --- a/src/msg/msg_types.h +++ b/src/msg/msg_types.h @@ -43,7 +43,7 @@ public: // cons entity_name_t() : _type(0), _num(0) { } entity_name_t(int t, int64_t n) : _type(t), _num(n) { } - entity_name_t(const ceph_entity_name &n) : + explicit entity_name_t(const ceph_entity_name &n) : _type(n.type), _num(n.num) { } // static cons @@ -222,7 +222,7 @@ struct entity_addr_t { entity_addr_t() : type(0), nonce(0) { memset(&addr, 0, sizeof(addr)); } - entity_addr_t(const ceph_entity_addr &o) { + explicit entity_addr_t(const ceph_entity_addr &o) { type = o.type; nonce = o.nonce; addr = o.in_addr; diff --git a/src/msg/simple/DispatchQueue.h b/src/msg/simple/DispatchQueue.h index d379f55881cf..dca304a83c18 100644 --- a/src/msg/simple/DispatchQueue.h +++ b/src/msg/simple/DispatchQueue.h @@ -44,7 +44,7 @@ class DispatchQueue { ConnectionRef con; MessageRef m; public: - QueueItem(Message *m) : type(-1), con(0), m(m) {} + explicit QueueItem(Message *m) : type(-1), con(0), m(m) {} QueueItem(int type, Connection *con) : type(type), con(con), m(0) {} bool is_code() const { return type != -1; @@ -98,7 +98,7 @@ class DispatchQueue { class DispatchThread : public Thread { DispatchQueue *dq; public: - DispatchThread(DispatchQueue *dq) : dq(dq) {} + explicit DispatchThread(DispatchQueue *dq) : dq(dq) {} void *entry() { dq->entry(); return 0; @@ -112,7 +112,7 @@ class DispatchQueue { class LocalDeliveryThread : public Thread { DispatchQueue *dq; public: - LocalDeliveryThread(DispatchQueue *dq) : dq(dq) {} + explicit LocalDeliveryThread(DispatchQueue *dq) : dq(dq) {} void *entry() { dq->run_local_delivery(); return 0; diff --git a/src/msg/simple/Pipe.h b/src/msg/simple/Pipe.h index bbe8aa22b669..664f733f4688 100644 --- a/src/msg/simple/Pipe.h +++ b/src/msg/simple/Pipe.h @@ -46,7 +46,7 @@ class DispatchQueue; class Reader : public Thread { Pipe *pipe; public: - Reader(Pipe *p) : pipe(p) {} + explicit Reader(Pipe *p) : pipe(p) {} void *entry() { pipe->reader(); return 0; } } reader_thread; @@ -57,7 +57,7 @@ class DispatchQueue; class Writer : public Thread { Pipe *pipe; public: - Writer(Pipe *p) : pipe(p) {} + explicit Writer(Pipe *p) : pipe(p) {} void *entry() { pipe->writer(); return 0; } } writer_thread; @@ -81,7 +81,7 @@ class DispatchQueue; bool stop_fast_dispatching_flag; // we need to stop fast dispatching public: - DelayedDelivery(Pipe *p) + explicit DelayedDelivery(Pipe *p) : pipe(p), delay_lock("Pipe::DelayedDelivery::delay_lock"), flush_count(0), active_flush(false), diff --git a/src/msg/simple/SimpleMessenger.h b/src/msg/simple/SimpleMessenger.h index c05ccc6712b0..5eb441e86ef6 100644 --- a/src/msg/simple/SimpleMessenger.h +++ b/src/msg/simple/SimpleMessenger.h @@ -191,7 +191,7 @@ private: class ReaperThread : public Thread { SimpleMessenger *msgr; public: - ReaperThread(SimpleMessenger *m) : msgr(m) {} + explicit ReaperThread(SimpleMessenger *m) : msgr(m) {} void *entry() { msgr->reaper_entry(); return 0; diff --git a/src/msg/xio/QueueStrategy.h b/src/msg/xio/QueueStrategy.h index b5f9e8aedd46..7b23d8ff25ff 100644 --- a/src/msg/xio/QueueStrategy.h +++ b/src/msg/xio/QueueStrategy.h @@ -34,7 +34,7 @@ class QueueStrategy : public DispatchStrategy { bi::list_member_hook<> thread_q; QueueStrategy *dq; Cond cond; - QSThread(QueueStrategy *dq) : thread_q(), dq(dq), cond() {} + explicit QSThread(QueueStrategy *dq) : thread_q(), dq(dq), cond() {} void* entry() { dq->entry(this); delete(this); @@ -50,7 +50,7 @@ class QueueStrategy : public DispatchStrategy { QSThread::Queue disp_threads; public: - QueueStrategy(int n_threads); + explicit QueueStrategy(int n_threads); virtual void ds_dispatch(Message *m); virtual void shutdown(); virtual void start(); diff --git a/src/msg/xio/XioConnection.h b/src/msg/xio/XioConnection.h index da34d6e5520f..a38728ae28a8 100644 --- a/src/msg/xio/XioConnection.h +++ b/src/msg/xio/XioConnection.h @@ -142,7 +142,7 @@ private: uint32_t flags; - CState(XioConnection* _xcon) + explicit CState(XioConnection* _xcon) : xcon(_xcon), protocol_version(0), session_state(INIT), @@ -322,7 +322,7 @@ class XioLoopbackConnection : public Connection private: atomic_t seq; public: - XioLoopbackConnection(Messenger *m) : Connection(m->cct, m), seq(0) + explicit XioLoopbackConnection(Messenger *m) : Connection(m->cct, m), seq(0) { const entity_inst_t& m_inst = m->get_myinst(); peer_addr = m_inst.addr; diff --git a/src/msg/xio/XioMsg.h b/src/msg/xio/XioMsg.h index 68d8ebe05afd..0cba48a0d73b 100644 --- a/src/msg/xio/XioMsg.h +++ b/src/msg/xio/XioMsg.h @@ -34,7 +34,7 @@ public: __le32 msg_cnt; buffer::list bl; public: - XioMsgCnt(buffer::ptr p) + explicit XioMsgCnt(buffer::ptr p) { bl.append(p); buffer::list::iterator bl_iter = bl.begin(); @@ -145,7 +145,7 @@ struct xio_msg_ex struct xio_msg msg; struct xio_iovec_ex iovs[XIO_MSGR_IOVLEN]; - xio_msg_ex(void* user_context) { + explicit xio_msg_ex(void* user_context) { // go in structure order msg.in.header.iov_len = 0; msg.in.header.iov_base = NULL; /* XXX Accelio requires this currently */ diff --git a/src/msg/xio/XioPool.h b/src/msg/xio/XioPool.h index c8e7b87a76b3..f7c950fb434d 100644 --- a/src/msg/xio/XioPool.h +++ b/src/msg/xio/XioPool.h @@ -48,7 +48,7 @@ public: char payload[MB]; } *first; - XioPool(struct xio_mempool *_handle) : + explicit XioPool(struct xio_mempool *_handle) : handle(_handle), first(0) { } diff --git a/src/msg/xio/XioPortal.h b/src/msg/xio/XioPortal.h index cb711c66d24c..ab5d132d4073 100644 --- a/src/msg/xio/XioPortal.h +++ b/src/msg/xio/XioPortal.h @@ -129,7 +129,7 @@ private: friend class XioMessenger; public: - XioPortal(Messenger *_msgr) : + explicit XioPortal(Messenger *_msgr) : msgr(_msgr), ctx(NULL), server(NULL), submit_q(), xio_uri(""), portal_id(NULL), _shutdown(false), drained(false), magic(0), diff --git a/src/os/FuseStore.h b/src/os/FuseStore.h index 192b88bc9d5d..751c52aa020a 100644 --- a/src/os/FuseStore.h +++ b/src/os/FuseStore.h @@ -16,7 +16,7 @@ public: class FuseThread : public Thread { FuseStore *fs; public: - FuseThread(FuseStore *f) : fs(f) {} + explicit FuseThread(FuseStore *f) : fs(f) {} void *entry() { fs->loop(); return NULL; diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index cc8b78374ba8..3e32fd63dd77 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -181,7 +181,7 @@ public: string name; Sequencer_implRef p; - Sequencer(string n) + explicit Sequencer(string n) : name(n), p(NULL) {} ~Sequencer() { } @@ -214,7 +214,7 @@ public: struct CompatCollectionHandle : public CollectionImpl { coll_t cid; - CompatCollectionHandle(coll_t c) : cid(c) {} + explicit CompatCollectionHandle(coll_t c) : cid(c) {} const coll_t &get_cid() override { return cid; } @@ -509,10 +509,10 @@ public: public: Transaction() = default; - Transaction(bufferlist::iterator &dp) { + explicit Transaction(bufferlist::iterator &dp) { decode(dp); } - Transaction(bufferlist &nbl) { + explicit Transaction(bufferlist &nbl) { bufferlist::iterator dp = nbl.begin(); decode(dp); } @@ -896,7 +896,7 @@ public: vector objects; private: - iterator(Transaction *t) + explicit iterator(Transaction *t) : t(t), data_bl_p(t->data_bl.begin()), colls(t->coll_index.size()), @@ -1853,11 +1853,11 @@ public: } public: - ObjectStore(const std::string& path_) : path(path_), logger(NULL) {} + explicit ObjectStore(const std::string& path_) : path(path_), logger(NULL) {} virtual ~ObjectStore() {} // no copying - ObjectStore(const ObjectStore& o); + explicit ObjectStore(const ObjectStore& o); const ObjectStore& operator=(const ObjectStore& o); // versioning diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 77bb8eb49b1a..f8ecd28f1095 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -22,7 +22,7 @@ struct IOContext { atomic_t num_reading; atomic_t num_waiting; - IOContext(void *p) + explicit IOContext(void *p) : priv(p), lock("IOContext::lock") {} @@ -69,7 +69,7 @@ private: struct AioCompletionThread : public Thread { BlockDevice *bdev; - AioCompletionThread(BlockDevice *b) : bdev(b) {} + explicit AioCompletionThread(BlockDevice *b) : bdev(b) {} void *entry() { bdev->_aio_thread(); return NULL; diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 474a63a97b68..4eb9c0d1eab5 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -110,7 +110,7 @@ public: uint64_t pos; ///< current logical offset uint64_t max_prefetch; ///< max allowed prefetch - FileReaderBuffer(uint64_t mpf) + explicit FileReaderBuffer(uint64_t mpf) : bl_off(0), pos(0), max_prefetch(mpf) {} @@ -152,7 +152,7 @@ public: struct FileLock { FileRef file; - FileLock(FileRef f) : file(f) {} + explicit FileLock(FileRef f) : file(f) {} }; private: diff --git a/src/os/bluestore/BlueRocksEnv.cc b/src/os/bluestore/BlueRocksEnv.cc index 252bdbd12a40..847cb19df431 100644 --- a/src/os/bluestore/BlueRocksEnv.cc +++ b/src/os/bluestore/BlueRocksEnv.cc @@ -288,7 +288,7 @@ class BlueRocksWritableFile : public rocksdb::WritableFile { class BlueRocksDirectory : public rocksdb::Directory { BlueFS *fs; public: - BlueRocksDirectory(BlueFS *f) : fs(f) {} + explicit BlueRocksDirectory(BlueFS *f) : fs(f) {} // Fsync directory. Can be called concurrently from multiple threads. rocksdb::Status Fsync() { diff --git a/src/os/bluestore/BlueRocksEnv.h b/src/os/bluestore/BlueRocksEnv.h index b67a2db81566..a44aa9c1c046 100644 --- a/src/os/bluestore/BlueRocksEnv.h +++ b/src/os/bluestore/BlueRocksEnv.h @@ -150,7 +150,7 @@ public: rocksdb::Status GetAbsolutePath(const std::string& db_path, std::string* output_path); - BlueRocksEnv(BlueFS *f); + explicit BlueRocksEnv(BlueFS *f); private: BlueFS *fs; }; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 28ada142fb0b..582085cbb7db 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -93,7 +93,7 @@ public: boost::intrusive::unordered_set uset; - EnodeSet(unsigned n) + explicit EnodeSet(unsigned n) : num_buckets(n), buckets(n), uset(bucket_traits(buckets.data(), num_buckets)) { @@ -286,7 +286,7 @@ public: CollectionRef first_collection; ///< first referenced collection - TransContext(OpSequencer *o) + explicit TransContext(OpSequencer *o) : state(STATE_PREPARE), osr(o), ops(0), @@ -448,7 +448,7 @@ public: struct KVSyncThread : public Thread { BlueStore *store; - KVSyncThread(BlueStore *s) : store(s) {} + explicit KVSyncThread(BlueStore *s) : store(s) {} void *entry() { store->_kv_sync_thread(); return NULL; diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index ceb403a08ae9..9fbc00763ac2 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -45,7 +45,7 @@ ostream& operator<<(ostream& out, const bluestore_bdev_label_t& l); struct bluestore_cnode_t { uint32_t bits; ///< how many bits of coll pgid are significant - bluestore_cnode_t(int b=0) : bits(b) {} + explicit bluestore_cnode_t(int b=0) : bits(b) {} void encode(bufferlist& bl) const; void decode(bufferlist::iterator& p); diff --git a/src/os/filestore/BtrfsFileStoreBackend.h b/src/os/filestore/BtrfsFileStoreBackend.h index 9bc878f77676..2933eb1949ca 100644 --- a/src/os/filestore/BtrfsFileStoreBackend.h +++ b/src/os/filestore/BtrfsFileStoreBackend.h @@ -29,7 +29,7 @@ private: bool m_filestore_btrfs_clone_range; bool m_filestore_btrfs_snap; public: - BtrfsFileStoreBackend(FileStore *fs); + explicit BtrfsFileStoreBackend(FileStore *fs); ~BtrfsFileStoreBackend() {} const char *get_name() { return "btrfs"; diff --git a/src/os/filestore/CollectionIndex.h b/src/os/filestore/CollectionIndex.h index a9947cce531d..7e2fc55ce8f1 100644 --- a/src/os/filestore/CollectionIndex.h +++ b/src/os/filestore/CollectionIndex.h @@ -176,7 +176,7 @@ protected: /// Call prior to removing directory virtual int prep_delete() { return 0; } - CollectionIndex(coll_t collection): + explicit CollectionIndex(coll_t collection): access_lock_name ("CollectionIndex::access_lock::" + collection.to_str()), access_lock(access_lock_name.c_str()) {} diff --git a/src/os/filestore/DBObjectMap.h b/src/os/filestore/DBObjectMap.h index 1b5748548232..400c54a1f386 100644 --- a/src/os/filestore/DBObjectMap.h +++ b/src/os/filestore/DBObjectMap.h @@ -83,7 +83,7 @@ public: MapHeaderLock(const MapHeaderLock &); MapHeaderLock &operator=(const MapHeaderLock &); public: - MapHeaderLock(DBObjectMap *db) : db(db) {} + explicit MapHeaderLock(DBObjectMap *db) : db(db) {} MapHeaderLock(DBObjectMap *db, const ghobject_t &oid) : db(db), locked(oid) { Mutex::Locker l(db->header_lock); while (db->map_header_in_use.count(*locked)) @@ -115,9 +115,9 @@ public: } }; - DBObjectMap(KeyValueDB *db) : db(db), header_lock("DBOBjectMap"), - cache_lock("DBObjectMap::CacheLock"), - caches(g_conf->filestore_omap_header_cache_size) + explicit DBObjectMap(KeyValueDB *db) : db(db), header_lock("DBOBjectMap"), + cache_lock("DBObjectMap::CacheLock"), + caches(g_conf->filestore_omap_header_cache_size) {} int set_keys( @@ -241,7 +241,7 @@ public: __u8 v; uint64_t seq; State() : v(0), seq(1) {} - State(uint64_t seq) : v(0), seq(seq) {} + explicit State(uint64_t seq) : v(0), seq(seq) {} void encode(bufferlist &bl) const { ENCODE_START(2, 1, bl); @@ -516,7 +516,7 @@ private: class RemoveOnDelete { public: DBObjectMap *db; - RemoveOnDelete(DBObjectMap *db) : + explicit RemoveOnDelete(DBObjectMap *db) : db(db) {} void operator() (_Header *header) { Mutex::Locker l(db->header_lock); diff --git a/src/os/filestore/FDCache.h b/src/os/filestore/FDCache.h index 635043b7e061..566e65abbe90 100644 --- a/src/os/filestore/FDCache.h +++ b/src/os/filestore/FDCache.h @@ -38,7 +38,7 @@ public: class FD { public: const int fd; - FD(int _fd) : fd(_fd) { + explicit FD(int _fd) : fd(_fd) { assert(_fd >= 0); } int operator*() const { @@ -55,7 +55,7 @@ private: SharedLRU *registry; public: - FDCache(CephContext *cct) : cct(cct), + explicit FDCache(CephContext *cct) : cct(cct), registry_shards(cct->_conf->filestore_fd_cache_shards) { assert(cct); cct->_conf->add_observer(this); diff --git a/src/os/filestore/FileJournal.h b/src/os/filestore/FileJournal.h index 07d99f48ae5c..92d8b4b25f7e 100644 --- a/src/os/filestore/FileJournal.h +++ b/src/os/filestore/FileJournal.h @@ -347,7 +347,7 @@ private: class Writer : public Thread { FileJournal *journal; public: - Writer(FileJournal *fj) : journal(fj) {} + explicit Writer(FileJournal *fj) : journal(fj) {} void *entry() { journal->write_thread_entry(); return 0; @@ -357,7 +357,7 @@ private: class WriteFinisher : public Thread { FileJournal *journal; public: - WriteFinisher(FileJournal *fj) : journal(fj) {} + explicit WriteFinisher(FileJournal *fj) : journal(fj) {} void *entry() { journal->write_finish_thread_entry(); return 0; diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 6c7e0a38fea8..3e63b48ecce4 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -3586,7 +3586,7 @@ int FileStore::_clone_range(coll_t cid, const ghobject_t& oldoid, const ghobject class SyncEntryTimeout : public Context { public: - SyncEntryTimeout(int commit_timeo) + explicit SyncEntryTimeout(int commit_timeo) : m_commit_timeo(commit_timeo) { } diff --git a/src/os/filestore/FileStore.h b/src/os/filestore/FileStore.h index 93082fc3576f..0ddc87049d24 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -174,7 +174,7 @@ private: void sync_entry(); struct SyncThread : public Thread { FileStore *fs; - SyncThread(FileStore *f) : fs(f) {} + explicit SyncThread(FileStore *f) : fs(f) {} void *entry() { fs->sync_entry(); return 0; @@ -314,7 +314,7 @@ private: } } - OpSequencer(int i) + explicit OpSequencer(int i) : qlock("FileStore::OpSequencer::qlock", false, false), parent(0), apply_lock("FileStore::OpSequencer::apply_lock", false, false), @@ -785,7 +785,7 @@ protected: } public: - FileStoreBackend(FileStore *fs) : filestore(fs) {} + explicit FileStoreBackend(FileStore *fs) : filestore(fs) {} virtual ~FileStoreBackend() {} static FileStoreBackend *create(long f_type, FileStore *fs); diff --git a/src/os/filestore/GenericFileStoreBackend.h b/src/os/filestore/GenericFileStoreBackend.h index f31e2029a652..e2c4ec810daf 100644 --- a/src/os/filestore/GenericFileStoreBackend.h +++ b/src/os/filestore/GenericFileStoreBackend.h @@ -28,7 +28,7 @@ private: bool m_filestore_fsync_flushes_journal_data; bool m_filestore_splice; public: - GenericFileStoreBackend(FileStore *fs); + explicit GenericFileStoreBackend(FileStore *fs); virtual ~GenericFileStoreBackend() {} virtual const char *get_name() { diff --git a/src/os/filestore/HashIndex.h b/src/os/filestore/HashIndex.h index 2ed21860e624..d4222f912fa9 100644 --- a/src/os/filestore/HashIndex.h +++ b/src/os/filestore/HashIndex.h @@ -106,7 +106,7 @@ private: InProgressOp(int op, const vector &path) : op(op), path(path) {} - InProgressOp(bufferlist::iterator &bl) { + explicit InProgressOp(bufferlist::iterator &bl) { decode(bl); } diff --git a/src/os/filestore/IndexManager.h b/src/os/filestore/IndexManager.h index da71807dad1e..5317d2bc1fe9 100644 --- a/src/os/filestore/IndexManager.h +++ b/src/os/filestore/IndexManager.h @@ -31,7 +31,7 @@ struct Index { CollectionIndex *index; Index() : index(NULL) {} - Index(CollectionIndex* index) : index(index) {} + explicit Index(CollectionIndex* index) : index(index) {} CollectionIndex *operator->() { return index; } CollectionIndex &operator*() { return *index; } @@ -67,8 +67,8 @@ class IndexManager { int build_index(coll_t c, const char *path, CollectionIndex **index); public: /// Constructor - IndexManager(bool upgrade) : lock("IndexManager lock"), - upgrade(upgrade) {} + explicit IndexManager(bool upgrade) : lock("IndexManager lock"), + upgrade(upgrade) {} ~IndexManager(); diff --git a/src/os/filestore/JournalingObjectStore.h b/src/os/filestore/JournalingObjectStore.h index e7e50503b393..8b3bdaaba17f 100644 --- a/src/os/filestore/JournalingObjectStore.h +++ b/src/os/filestore/JournalingObjectStore.h @@ -129,7 +129,7 @@ public: } public: - JournalingObjectStore(const std::string& path) + explicit JournalingObjectStore(const std::string& path) : ObjectStore(path), journal(NULL), finisher(g_ceph_context, "JournalObjectStore", "fn_jrn_objstore"), diff --git a/src/os/filestore/LFNIndex.cc b/src/os/filestore/LFNIndex.cc index 7f8e6d00ffe5..4cc09c32cc12 100644 --- a/src/os/filestore/LFNIndex.cc +++ b/src/os/filestore/LFNIndex.cc @@ -65,7 +65,7 @@ void LFNIndex::maybe_inject_failure() // in combination with RetryException, thrown by the above. struct FDCloser { int fd; - FDCloser(int f) : fd(f) {} + explicit FDCloser(int f) : fd(f) {} ~FDCloser() { VOID_TEMP_FAILURE_RETRY(::close(fd)); } diff --git a/src/os/filestore/WBThrottle.h b/src/os/filestore/WBThrottle.h index f06ec877b2d4..9a3d0a788bfe 100644 --- a/src/os/filestore/WBThrottle.h +++ b/src/os/filestore/WBThrottle.h @@ -146,7 +146,7 @@ private: } public: - WBThrottle(CephContext *cct); + explicit WBThrottle(CephContext *cct); ~WBThrottle(); void start(); diff --git a/src/os/filestore/XfsFileStoreBackend.h b/src/os/filestore/XfsFileStoreBackend.h index 84d4694368d4..29f412f934a7 100644 --- a/src/os/filestore/XfsFileStoreBackend.h +++ b/src/os/filestore/XfsFileStoreBackend.h @@ -24,7 +24,7 @@ private: bool m_has_extsize; int set_extsize(int fd, unsigned int val); public: - XfsFileStoreBackend(FileStore *fs); + explicit XfsFileStoreBackend(FileStore *fs); ~XfsFileStoreBackend() {} const char *get_name() { return "xfs"; diff --git a/src/os/filestore/ZFSFileStoreBackend.h b/src/os/filestore/ZFSFileStoreBackend.h index f68b8abd6c12..1c15bdaacc18 100644 --- a/src/os/filestore/ZFSFileStoreBackend.h +++ b/src/os/filestore/ZFSFileStoreBackend.h @@ -16,7 +16,7 @@ private: bool m_filestore_zfs_snap; int update_current_zh(); public: - ZFSFileStoreBackend(FileStore *fs); + explicit ZFSFileStoreBackend(FileStore *fs); ~ZFSFileStoreBackend(); int detect_features(); bool can_checkpoint(); diff --git a/src/os/fs/FS.h b/src/os/fs/FS.h index e62d07e1779e..4b09bcecd70f 100644 --- a/src/os/fs/FS.h +++ b/src/os/fs/FS.h @@ -89,7 +89,7 @@ public: int max_iodepth; io_context_t ctx; - aio_queue_t(unsigned max_iodepth) + explicit aio_queue_t(unsigned max_iodepth) : max_iodepth(max_iodepth), ctx(0) { } diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 8bf70f0246ab..907383554067 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -201,7 +201,7 @@ public: CollectionRef first_collection; ///< first referenced collection - TransContext(OpSequencer *o) + explicit TransContext(OpSequencer *o) : state(STATE_PREPARE), osr(o), ops(0), @@ -272,7 +272,7 @@ public: struct KVSyncThread : public Thread { KStore *store; - KVSyncThread(KStore *s) : store(s) {} + explicit KVSyncThread(KStore *s) : store(s) {} void *entry() { store->_kv_sync_thread(); return NULL; diff --git a/src/os/kstore/kstore_types.h b/src/os/kstore/kstore_types.h index 02c75cb3c1e2..8a880742dd4a 100644 --- a/src/os/kstore/kstore_types.h +++ b/src/os/kstore/kstore_types.h @@ -28,7 +28,7 @@ namespace ceph { struct kstore_cnode_t { uint32_t bits; ///< how many bits of coll pgid are significant - kstore_cnode_t(int b=0) : bits(b) {} + explicit kstore_cnode_t(int b=0) : bits(b) {} void encode(bufferlist& bl) const; void decode(bufferlist::iterator& p); diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 8b56ddc43087..5dad53760dcd 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -130,7 +130,7 @@ public: static thread_local PageSet::page_vector tls_pages; #endif - PageSetObject(size_t page_size) : data(page_size), data_len(0) {} + explicit PageSetObject(size_t page_size) : data(page_size), data_len(0) {} size_t get_size() const override { return data_len; } @@ -243,7 +243,7 @@ public: return result; } - Collection(CephContext *cct) + explicit Collection(CephContext *cct) : cct(cct), use_page_set(cct->_conf->memstore_page_set), lock("MemStore::Collection::lock"), exists(true) {} }; diff --git a/src/os/memstore/PageSet.h b/src/os/memstore/PageSet.h index b7ef12b3c201..b3e1f131a220 100644 --- a/src/os/memstore/PageSet.h +++ b/src/os/memstore/PageSet.h @@ -126,7 +126,7 @@ class PageSet { } public: - PageSet(size_t page_size) : page_size(page_size) {} + explicit PageSet(size_t page_size) : page_size(page_size) {} PageSet(PageSet &&rhs) : pages(std::move(rhs.pages)), page_size(rhs.page_size) {} ~PageSet() { diff --git a/src/osd/ClassHandler.h b/src/osd/ClassHandler.h index a78c9e624640..3fe1f98d1a7a 100644 --- a/src/osd/ClassHandler.h +++ b/src/osd/ClassHandler.h @@ -107,7 +107,7 @@ private: int _load_class(ClassData *cls); public: - ClassHandler(CephContext *cct_) : cct(cct_), mutex("ClassHandler") {} + explicit ClassHandler(CephContext *cct_) : cct(cct_), mutex("ClassHandler") {} int open_all_classes(); diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index 2f7b3b7cdfe4..bee32fd08468 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -137,7 +137,7 @@ public: struct ClientAsyncReadStatus { bool complete; Context *on_complete; - ClientAsyncReadStatus(Context *on_complete) + explicit ClientAsyncReadStatus(Context *on_complete) : complete(false), on_complete(on_complete) {} }; list in_progress_client_reads; @@ -412,7 +412,7 @@ public: set want; ErasureCodeInterfaceRef ec_impl; public: - ECRecPred(ErasureCodeInterfaceRef ec_impl) : ec_impl(ec_impl) { + explicit ECRecPred(ErasureCodeInterfaceRef ec_impl) : ec_impl(ec_impl) { for (unsigned i = 0; i < ec_impl->get_chunk_count(); ++i) { want.insert(i); } diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc index c5d39eb50106..64dd89feac2c 100644 --- a/src/osd/ECTransaction.cc +++ b/src/osd/ECTransaction.cc @@ -24,7 +24,7 @@ struct AppendObjectsGenerator: public boost::static_visitor { set *out; - AppendObjectsGenerator(set *out) : out(out) {} + explicit AppendObjectsGenerator(set *out) : out(out) {} void operator()(const ECTransaction::AppendOp &op) { out->insert(op.oid); } diff --git a/src/osd/ECTransaction.h b/src/osd/ECTransaction.h index 2615226885d2..fd968caa660c 100644 --- a/src/osd/ECTransaction.h +++ b/src/osd/ECTransaction.h @@ -52,11 +52,11 @@ public: }; struct TouchOp { hobject_t oid; - TouchOp(const hobject_t &oid) : oid(oid) {} + explicit TouchOp(const hobject_t &oid) : oid(oid) {} }; struct RemoveOp { hobject_t oid; - RemoveOp(const hobject_t &oid) : oid(oid) {} + explicit RemoveOp(const hobject_t &oid) : oid(oid) {} }; struct SetAttrsOp { hobject_t oid; diff --git a/src/osd/ECUtil.h b/src/osd/ECUtil.h index 8e1261c5ebab..968056ddf83d 100644 --- a/src/osd/ECUtil.h +++ b/src/osd/ECUtil.h @@ -109,7 +109,7 @@ class HashInfo { vector cumulative_shard_hashes; public: HashInfo() : total_chunk_size(0) {} - HashInfo(unsigned num_chunks) + explicit HashInfo(unsigned num_chunks) : total_chunk_size(0), cumulative_shard_hashes(num_chunks, -1) {} void append(uint64_t old_size, map &to_append); diff --git a/src/osd/HitSet.h b/src/osd/HitSet.h index 2b981a3eaacf..42292970f973 100644 --- a/src/osd/HitSet.h +++ b/src/osd/HitSet.h @@ -92,7 +92,7 @@ public: }; Params() {} - Params(Impl *i) : impl(i) {} + explicit Params(Impl *i) : impl(i) {} virtual ~Params() {} boost::scoped_ptr impl; @@ -115,8 +115,8 @@ public: }; HitSet() : impl(NULL), sealed(false) {} - HitSet(Impl *i) : impl(i), sealed(false) {} - HitSet(const HitSet::Params& params); + explicit HitSet(Impl *i) : impl(i), sealed(false) {} + explicit HitSet(const HitSet::Params& params); HitSet(const HitSet& o) { sealed = o.sealed; @@ -195,7 +195,7 @@ public: }; ExplicitHashHitSet() : count(0) {} - ExplicitHashHitSet(const ExplicitHashHitSet::Params *p) : count(0) {} + explicit ExplicitHashHitSet(const ExplicitHashHitSet::Params *p) : count(0) {} ExplicitHashHitSet(const ExplicitHashHitSet &o) : count(o.count), hits(o.hits) {} @@ -272,7 +272,7 @@ public: }; ExplicitObjectHitSet() : count(0) {} - ExplicitObjectHitSet(const ExplicitObjectHitSet::Params *p) : count(0) {} + explicit ExplicitObjectHitSet(const ExplicitObjectHitSet::Params *p) : count(0) {} ExplicitObjectHitSet(const ExplicitObjectHitSet &o) : count(o.count), hits(o.hits) {} @@ -409,7 +409,7 @@ public: BloomHitSet(unsigned inserts, double fpp, int seed) : bloom(inserts, fpp, seed) {} - BloomHitSet(const BloomHitSet::Params *p) : bloom(p->target_size, + explicit BloomHitSet(const BloomHitSet::Params *p) : bloom(p->target_size, p->get_fpp(), p->seed) {} diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 760fe49ac4d0..7fb5b6fbb1b5 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -507,7 +507,7 @@ void OSDService::activate_map() class AgentTimeoutCB : public Context { PGRef pg; public: - AgentTimeoutCB(PGRef _pg) : pg(_pg) {} + explicit AgentTimeoutCB(PGRef _pg) : pg(_pg) {} void finish(int) { pg->agent_choose_mode_restart(); } @@ -1670,7 +1670,7 @@ int OSD::pre_init() class OSDSocketHook : public AdminSocketHook { OSD *osd; public: - OSDSocketHook(OSD *o) : osd(o) {} + explicit OSDSocketHook(OSD *o) : osd(o) {} bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& out) { stringstream ss; @@ -4500,7 +4500,7 @@ bool OSD::ms_handle_reset(Connection *con) struct C_OSD_GetVersion : public Context { OSD *osd; uint64_t oldest, newest; - C_OSD_GetVersion(OSD *o) : osd(o), oldest(0), newest(0) {} + explicit C_OSD_GetVersion(OSD *o) : osd(o), oldest(0), newest(0) {} void finish(int r) { if (r >= 0) osd->_got_mon_epochs(oldest, newest); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 4d274cfb1399..9e149032a4ad 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -237,7 +237,7 @@ class DeletingState { public: const spg_t pgid; const PGRef old_pg_state; - DeletingState(const pair &in) : + explicit DeletingState(const pair &in) : lock("DeletingState::lock"), status(QUEUED), stop_deleting(false), pgid(in.first), old_pg_state(in.second) { } @@ -328,7 +328,7 @@ class OSD; struct PGScrub { epoch_t epoch_queued; - PGScrub(epoch_t e) : epoch_queued(e) {} + explicit PGScrub(epoch_t e) : epoch_queued(e) {} ostream &operator<<(ostream &rhs) { return rhs << "PGScrub"; } @@ -336,7 +336,7 @@ struct PGScrub { struct PGSnapTrim { epoch_t epoch_queued; - PGSnapTrim(epoch_t e) : epoch_queued(e) {} + explicit PGSnapTrim(epoch_t e) : epoch_queued(e) {} ostream &operator<<(ostream &rhs) { return rhs << "PGSnapTrim"; } @@ -667,7 +667,7 @@ public: bool agent_active; struct AgentThread : public Thread { OSDService *osd; - AgentThread(OSDService *o) : osd(o) {} + explicit AgentThread(OSDService *o) : osd(o) {} void *entry() { osd->agent_entry(); return NULL; @@ -1032,7 +1032,7 @@ public: } #endif - OSDService(OSD *osd); + explicit OSDService(OSD *osd); ~OSDService(); }; @@ -1092,7 +1092,7 @@ protected: class C_Tick : public Context { OSD *osd; public: - C_Tick(OSD *o) : osd(o) {} + explicit C_Tick(OSD *o) : osd(o) {} void finish(int r) { osd->tick(); } @@ -1101,7 +1101,7 @@ protected: class C_Tick_WithoutOSDLock : public Context { OSD *osd; public: - C_Tick_WithoutOSDLock(OSD *o) : osd(o) {} + explicit C_Tick_WithoutOSDLock(OSD *o) : osd(o) {} void finish(int r) { osd->tick_without_osd_lock(); } @@ -1316,7 +1316,7 @@ public: Spinlock received_map_lock; epoch_t received_map_epoch; // largest epoch seen in MOSDMap from here - Session(CephContext *cct) : + explicit Session(CephContext *cct) : RefCountedObject(cct), auid(-1), con(0), session_dispatch_lock("Session::session_dispatch_lock"), @@ -1509,7 +1509,7 @@ private: /// state attached to outgoing heartbeat connections struct HeartbeatSession : public RefCountedObject { int peer; - HeartbeatSession(int p) : peer(p) {} + explicit HeartbeatSession(int p) : peer(p) {} }; Mutex heartbeat_lock; map debug_heartbeat_drops_remaining; @@ -1550,7 +1550,7 @@ private: struct T_Heartbeat : public Thread { OSD *osd; - T_Heartbeat(OSD *o) : osd(o) {} + explicit T_Heartbeat(OSD *o) : osd(o) {} void *entry() { osd->heartbeat_entry(); return 0; @@ -1562,7 +1562,7 @@ public: struct HeartbeatDispatcher : public Dispatcher { OSD *osd; - HeartbeatDispatcher(OSD *o) : Dispatcher(cct), osd(o) {} + explicit HeartbeatDispatcher(OSD *o) : Dispatcher(cct), osd(o) {} bool ms_dispatch(Message *m) { return osd->heartbeat_dispatch(m); } @@ -1687,7 +1687,7 @@ private: struct Pred { PG *pg; - Pred(PG *pg) : pg(pg) {} + explicit Pred(PG *pg) : pg(pg) {} bool operator()(const pair &op) { return op.first == pg; } diff --git a/src/osd/OSDCap.h b/src/osd/OSDCap.h index 905fa55c548c..55f362692fc0 100644 --- a/src/osd/OSDCap.h +++ b/src/osd/OSDCap.h @@ -60,8 +60,8 @@ struct OSDCapSpec { std::string class_allow; OSDCapSpec() : allow(0) {} - OSDCapSpec(osd_rwxa_t v) : allow(v) {} - OSDCapSpec(std::string n) : allow(0), class_name(n) {} + explicit OSDCapSpec(osd_rwxa_t v) : allow(v) {} + explicit OSDCapSpec(std::string n) : allow(0), class_name(n) {} OSDCapSpec(std::string n, std::string a) : allow(0), class_name(n), class_allow(a) {} bool allow_all() const { @@ -119,7 +119,7 @@ struct OSDCap { std::vector grants; OSDCap() {} - OSDCap(std::vector g) : grants(g) {} + explicit OSDCap(std::vector g) : grants(g) {} bool allow_all() const; void set_allow_all(); diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 24c287f4aa81..55b4ec1367da 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -171,17 +171,17 @@ public: void dump(Formatter *f) const; static void generate_test_instances(list& o); - Incremental(epoch_t e=0) : + explicit Incremental(epoch_t e=0) : encode_features(0), epoch(e), new_pool_max(-1), new_flags(-1), new_max_osd(-1), have_crc(false), full_crc(0), inc_crc(0) { memset(&fsid, 0, sizeof(fsid)); } - Incremental(bufferlist &bl) { + explicit Incremental(bufferlist &bl) { bufferlist::iterator p = bl.begin(); decode(p); } - Incremental(bufferlist::iterator &p) { + explicit Incremental(bufferlist::iterator &p) { decode(p); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 210f15388ddc..8609467e0902 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2069,7 +2069,7 @@ bool PG::queue_scrub() struct C_PG_FinishRecovery : public Context { PGRef pg; - C_PG_FinishRecovery(PG *p) : pg(p) {} + explicit C_PG_FinishRecovery(PG *p) : pg(p) {} void finish(int r) { pg->_finish_recovery(this); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 8265f463cdde..381059899566 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -320,7 +320,7 @@ public: public: boost::scoped_ptr is_readable; boost::scoped_ptr is_recoverable; - MissingLoc(PG *pg) + explicit MissingLoc(PG *pg) : pg(pg) {} void set_backend_predicates( IsPGReadablePredicate *_is_readable, @@ -658,7 +658,7 @@ public: hobject_t begin; hobject_t end; - BackfillInterval(bool bitwise=true) + explicit BackfillInterval(bool bitwise=true) : objects(hobject_t::Comparator(bitwise)), sort_bitwise(bitwise) {} @@ -1333,7 +1333,7 @@ public: struct QueryState : boost::statechart::event< QueryState > { Formatter *f; - QueryState(Formatter *f) : f(f) {} + explicit QueryState(Formatter *f) : f(f) {} void print(std::ostream *out) const { *out << "Query"; } @@ -1412,7 +1412,7 @@ public: }; struct Activate : boost::statechart::event< Activate > { epoch_t activation_epoch; - Activate(epoch_t q) : boost::statechart::event< Activate >(), + explicit Activate(epoch_t q) : boost::statechart::event< Activate >(), activation_epoch(q) {} void print(std::ostream *out) const { *out << "Activate from " << activation_epoch; @@ -1420,7 +1420,7 @@ public: }; struct RequestBackfillPrio : boost::statechart::event< RequestBackfillPrio > { unsigned priority; - RequestBackfillPrio(unsigned prio) : + explicit RequestBackfillPrio(unsigned prio) : boost::statechart::event< RequestBackfillPrio >(), priority(prio) {} void print(std::ostream *out) const { @@ -1544,14 +1544,14 @@ public: /* States */ struct Crashed : boost::statechart::state< Crashed, RecoveryMachine >, NamedState { - Crashed(my_context ctx); + explicit Crashed(my_context ctx); }; struct Started; struct Reset; struct Initial : boost::statechart::state< Initial, RecoveryMachine >, NamedState { - Initial(my_context ctx); + explicit Initial(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1571,7 +1571,7 @@ public: }; struct Reset : boost::statechart::state< Reset, RecoveryMachine >, NamedState { - Reset(my_context ctx); + explicit Reset(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1596,7 +1596,7 @@ public: struct Start; struct Started : boost::statechart::state< Started, RecoveryMachine, Start >, NamedState { - Started(my_context ctx); + explicit Started(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1626,7 +1626,7 @@ public: struct Stray; struct Start : boost::statechart::state< Start, Started >, NamedState { - Start(my_context ctx); + explicit Start(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1646,7 +1646,7 @@ public: }; struct Primary : boost::statechart::state< Primary, Started, Peering >, NamedState { - Primary(my_context ctx); + explicit Primary(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1667,7 +1667,7 @@ public: boost::statechart::custom_reaction< MInfoRec >, boost::statechart::custom_reaction< MNotifyRec > > reactions; - WaitActingChange(my_context ctx); + explicit WaitActingChange(my_context ctx); boost::statechart::result react(const QueryState& q); boost::statechart::result react(const AdvMap&); boost::statechart::result react(const MLogRec&); @@ -1682,7 +1682,7 @@ public: struct Peering : boost::statechart::state< Peering, Primary, GetInfo >, NamedState { std::unique_ptr< PriorSet > prior_set; - Peering(my_context ctx); + explicit Peering(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1697,7 +1697,7 @@ public: struct WaitLocalRecoveryReserved; struct Activating; struct Active : boost::statechart::state< Active, Primary, Activating >, NamedState { - Active(my_context ctx); + explicit Active(my_context ctx); void exit(); const set remote_shards_to_reserve_recovery; @@ -1730,7 +1730,7 @@ public: typedef boost::mpl::list< boost::statechart::transition< DoRecovery, WaitLocalRecoveryReserved > > reactions; - Clean(my_context ctx); + explicit Clean(my_context ctx); void exit(); }; @@ -1739,7 +1739,7 @@ public: boost::statechart::transition< GoClean, Clean >, boost::statechart::custom_reaction< AllReplicasActivated > > reactions; - Recovered(my_context ctx); + explicit Recovered(my_context ctx); void exit(); boost::statechart::result react(const AllReplicasActivated&) { post_event(GoClean()); @@ -1752,7 +1752,7 @@ public: boost::statechart::transition< Backfilled, Recovered >, boost::statechart::custom_reaction< RemoteReservationRejected > > reactions; - Backfilling(my_context ctx); + explicit Backfilling(my_context ctx); boost::statechart::result react(const RemoteReservationRejected& evt); void exit(); }; @@ -1764,7 +1764,7 @@ public: boost::statechart::transition< AllBackfillsReserved, Backfilling > > reactions; set::const_iterator backfill_osd_it; - WaitRemoteBackfillReserved(my_context ctx); + explicit WaitRemoteBackfillReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteBackfillReserved& evt); boost::statechart::result react(const RemoteReservationRejected& evt); @@ -1774,7 +1774,7 @@ public: typedef boost::mpl::list< boost::statechart::transition< LocalBackfillReserved, WaitRemoteBackfillReserved > > reactions; - WaitLocalBackfillReserved(my_context ctx); + explicit WaitLocalBackfillReserved(my_context ctx); void exit(); }; @@ -1784,7 +1784,7 @@ public: boost::statechart::custom_reaction< RemoteBackfillReserved >, boost::statechart::custom_reaction< RemoteReservationRejected > > reactions; - NotBackfilling(my_context ctx); + explicit NotBackfilling(my_context ctx); void exit(); boost::statechart::result react(const RemoteBackfillReserved& evt); boost::statechart::result react(const RemoteReservationRejected& evt); @@ -1792,7 +1792,7 @@ public: struct RepNotRecovering; struct ReplicaActive : boost::statechart::state< ReplicaActive, Started, RepNotRecovering >, NamedState { - ReplicaActive(my_context ctx); + explicit ReplicaActive(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1817,7 +1817,7 @@ public: boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >, boost::statechart::custom_reaction< BackfillTooFull > > reactions; - RepRecovering(my_context ctx); + explicit RepRecovering(my_context ctx); boost::statechart::result react(const BackfillTooFull &evt); void exit(); }; @@ -1827,7 +1827,7 @@ public: boost::statechart::custom_reaction< RemoteBackfillReserved >, boost::statechart::custom_reaction< RemoteReservationRejected > > reactions; - RepWaitBackfillReserved(my_context ctx); + explicit RepWaitBackfillReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteBackfillReserved &evt); boost::statechart::result react(const RemoteReservationRejected &evt); @@ -1837,7 +1837,7 @@ public: typedef boost::mpl::list< boost::statechart::custom_reaction< RemoteRecoveryReserved > > reactions; - RepWaitRecoveryReserved(my_context ctx); + explicit RepWaitRecoveryReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteRecoveryReserved &evt); }; @@ -1848,7 +1848,7 @@ public: boost::statechart::transition< RequestRecovery, RepWaitRecoveryReserved >, boost::statechart::transition< RecoveryDone, RepNotRecovering > // for compat with pre-reservation peers > reactions; - RepNotRecovering(my_context ctx); + explicit RepNotRecovering(my_context ctx); boost::statechart::result react(const RequestBackfillPrio &evt); void exit(); }; @@ -1858,7 +1858,7 @@ public: boost::statechart::custom_reaction< AllReplicasRecovered >, boost::statechart::custom_reaction< RequestBackfill > > reactions; - Recovering(my_context ctx); + explicit Recovering(my_context ctx); void exit(); void release_reservations(); boost::statechart::result react(const AllReplicasRecovered &evt); @@ -1871,7 +1871,7 @@ public: boost::statechart::transition< AllRemotesReserved, Recovering > > reactions; set::const_iterator remote_recovery_reservation_it; - WaitRemoteRecoveryReserved(my_context ctx); + explicit WaitRemoteRecoveryReserved(my_context ctx); boost::statechart::result react(const RemoteRecoveryReserved &evt); void exit(); }; @@ -1880,7 +1880,7 @@ public: typedef boost::mpl::list < boost::statechart::transition< LocalRecoveryReserved, WaitRemoteRecoveryReserved > > reactions; - WaitLocalRecoveryReserved(my_context ctx); + explicit WaitLocalRecoveryReserved(my_context ctx); void exit(); }; @@ -1890,14 +1890,14 @@ public: boost::statechart::transition< DoRecovery, WaitLocalRecoveryReserved >, boost::statechart::transition< RequestBackfill, WaitLocalBackfillReserved > > reactions; - Activating(my_context ctx); + explicit Activating(my_context ctx); void exit(); }; struct Stray : boost::statechart::state< Stray, Started >, NamedState { map > pending_queries; - Stray(my_context ctx); + explicit Stray(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1921,7 +1921,7 @@ public: struct GetInfo : boost::statechart::state< GetInfo, Peering >, NamedState { set peer_info_requested; - GetInfo(my_context ctx); + explicit GetInfo(my_context ctx); void exit(); void get_infos(); @@ -1943,7 +1943,7 @@ public: pg_shard_t auth_log_shard; boost::intrusive_ptr msg; - GetLog(my_context ctx); + explicit GetLog(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1964,7 +1964,7 @@ public: struct GetMissing : boost::statechart::state< GetMissing, Peering >, NamedState { set peer_missing_requested; - GetMissing(my_context ctx); + explicit GetMissing(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1977,7 +1977,7 @@ public: }; struct WaitUpThru : boost::statechart::state< WaitUpThru, Peering >, NamedState { - WaitUpThru(my_context ctx); + explicit WaitUpThru(my_context ctx); void exit(); typedef boost::mpl::list < @@ -1995,7 +1995,7 @@ public: boost::statechart::custom_reaction< AdvMap >, boost::statechart::custom_reaction< MNotifyRec > > reactions; - Incomplete(my_context ctx); + explicit Incomplete(my_context ctx); boost::statechart::result react(const AdvMap &advmap); boost::statechart::result react(const MNotifyRec& infoevt); void exit(); @@ -2019,7 +2019,7 @@ public: boost::optional rctx; public: - RecoveryState(PG *pg) + explicit RecoveryState(PG *pg) : machine(this, pg), pg(pg), orig_ctx(0) { machine.initiate(); } diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index 2be5975e860d..4ff5b48d79b8 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -86,7 +86,7 @@ public: class RPCReadPred : public IsPGReadablePredicate { pg_shard_t whoami; public: - RPCReadPred(pg_shard_t whoami) : whoami(whoami) {} + explicit RPCReadPred(pg_shard_t whoami) : whoami(whoami) {} bool operator()(const set &have) const { return have.count(whoami); } diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 752ef73b5c1c..464c8a6bf6c5 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -132,7 +132,7 @@ public: ReplicatedPG::CopyResults *results; int retval; ReplicatedPG::OpContext *ctx; - CopyFromCallback(ReplicatedPG::OpContext *ctx_) + explicit CopyFromCallback(ReplicatedPG::OpContext *ctx_) : results(NULL), retval(0), ctx(ctx_) {} @@ -9364,7 +9364,7 @@ ObjectContextRef ReplicatedPG::mark_object_lost(ObjectStore::Transaction *t, struct C_PG_MarkUnfoundLost : public Context { ReplicatedPGRef pg; list obcs; - C_PG_MarkUnfoundLost(ReplicatedPG *p) : pg(p) {} + explicit C_PG_MarkUnfoundLost(ReplicatedPG *p) : pg(p) {} void finish(int r) { pg->_finish_mark_all_unfound_lost(obcs); } @@ -11729,7 +11729,7 @@ bool ReplicatedPG::agent_maybe_flush(ObjectContextRef& obc) struct C_AgentEvictStartStop : public Context { ReplicatedPGRef pg; - C_AgentEvictStartStop(ReplicatedPG *p) : pg(p) { + explicit C_AgentEvictStartStop(ReplicatedPG *p) : pg(p) { pg->osd->agent_start_evict_op(); } void finish(int r) { @@ -12120,7 +12120,7 @@ bool ReplicatedPG::_range_available_for_scrub( struct C_ScrubDigestUpdated : public Context { ReplicatedPGRef pg; - C_ScrubDigestUpdated(ReplicatedPG *pg) : pg(pg) {} + explicit C_ScrubDigestUpdated(ReplicatedPG *pg) : pg(pg) {} void finish(int r) { pg->_scrub_digest_updated(); } diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 1e6fcb2002fe..265967a456af 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -509,7 +509,7 @@ public: boost::optional watch_cookie; uint64_t notify_id; bufferlist reply_bl; - NotifyAck(uint64_t notify_id) : notify_id(notify_id) {} + explicit NotifyAck(uint64_t notify_id) : notify_id(notify_id) {} NotifyAck(uint64_t notify_id, uint64_t cookie, bufferlist& rbl) : watch_cookie(cookie), notify_id(notify_id) { reply_bl.claim(rbl); @@ -1298,7 +1298,7 @@ protected: }; struct C_OSD_OndiskWriteUnlockList : public Context { list *pls; - C_OSD_OndiskWriteUnlockList(list *l) : pls(l) {} + explicit C_OSD_OndiskWriteUnlockList(list *l) : pls(l) {} void finish(int r) { for (list::iterator p = pls->begin(); p != pls->end(); ++p) (*p)->ondisk_write_unlock(); @@ -1327,7 +1327,7 @@ protected: }; struct C_OSD_AppliedRecoveredObjectReplica : public Context { ReplicatedPGRef pg; - C_OSD_AppliedRecoveredObjectReplica(ReplicatedPG *p) : + explicit C_OSD_AppliedRecoveredObjectReplica(ReplicatedPG *p) : pg(p) {} void finish(int r) { pg->_applied_recovered_object_replica(); @@ -1543,7 +1543,7 @@ private: set repops; snapid_t snap_to_trim; bool need_share_pg_info; - SnapTrimmer(ReplicatedPG *pg) : pg(pg), need_share_pg_info(false) {} + explicit SnapTrimmer(ReplicatedPG *pg) : pg(pg), need_share_pg_info(false) {} ~SnapTrimmer(); void log_enter(const char *state_name); void log_exit(const char *state_name, utime_t duration); @@ -1556,7 +1556,7 @@ private: boost::statechart::transition< Reset, NotTrimming > > reactions; hobject_t pos; - TrimmingObjects(my_context ctx); + explicit TrimmingObjects(my_context ctx); void exit(); boost::statechart::result react(const SnapTrim&); }; @@ -1566,7 +1566,7 @@ private: boost::statechart::custom_reaction< SnapTrim >, boost::statechart::transition< Reset, NotTrimming > > reactions; - WaitingOnReplicas(my_context ctx); + explicit WaitingOnReplicas(my_context ctx); void exit(); boost::statechart::result react(const SnapTrim&); }; @@ -1576,7 +1576,7 @@ private: boost::statechart::custom_reaction< SnapTrim >, boost::statechart::transition< Reset, NotTrimming > > reactions; - NotTrimming(my_context ctx); + explicit NotTrimming(my_context ctx); void exit(); boost::statechart::result react(const SnapTrim&); }; diff --git a/src/osd/SnapMapper.cc b/src/osd/SnapMapper.cc index ea25b4e2dc4e..6be5018d9a9e 100644 --- a/src/osd/SnapMapper.cc +++ b/src/osd/SnapMapper.cc @@ -53,7 +53,7 @@ int OSDriver::get_next( struct Mapping { snapid_t snap; hobject_t hoid; - Mapping(const pair &in) + explicit Mapping(const pair &in) : snap(in.first), hoid(in.second) {} Mapping() : snap(0) {} void encode(bufferlist &bl) const { diff --git a/src/osd/Watch.cc b/src/osd/Watch.cc index 3e440b782355..dc665e02d09c 100644 --- a/src/osd/Watch.cc +++ b/src/osd/Watch.cc @@ -71,7 +71,7 @@ class NotifyTimeoutCB : public CancelableContext { NotifyRef notif; bool canceled; // protected by notif lock public: - NotifyTimeoutCB(NotifyRef notif) : notif(notif), canceled(false) {} + explicit NotifyTimeoutCB(NotifyRef notif) : notif(notif), canceled(false) {} void finish(int) { notif->osd->watch_lock.Unlock(); notif->lock.Lock(); @@ -234,7 +234,7 @@ class HandleWatchTimeout : public CancelableContext { WatchRef watch; public: bool canceled; // protected by watch->pg->lock - HandleWatchTimeout(WatchRef watch) : watch(watch), canceled(false) {} + explicit HandleWatchTimeout(WatchRef watch) : watch(watch), canceled(false) {} void cancel() { canceled = true; } @@ -258,7 +258,7 @@ class HandleDelayedWatchTimeout : public CancelableContext { WatchRef watch; public: bool canceled; - HandleDelayedWatchTimeout(WatchRef watch) : watch(watch), canceled(false) {} + explicit HandleDelayedWatchTimeout(WatchRef watch) : watch(watch), canceled(false) {} void cancel() { canceled = true; } diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 8537f3daa744..2d874e5fd826 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1021,7 +1021,7 @@ void pool_opts_t::dump(Formatter* f) const class pool_opts_encoder_t : public boost::static_visitor<> { public: - pool_opts_encoder_t(bufferlist& bl_) : bl(bl_) {} + explicit pool_opts_encoder_t(bufferlist& bl_) : bl(bl_) {} void operator()(std::string s) const { ::encode(static_cast(pool_opts_t::STR), bl); @@ -3284,7 +3284,7 @@ void ObjectModDesc::visit(Visitor *visitor) const struct DumpVisitor : public ObjectModDesc::Visitor { Formatter *f; - DumpVisitor(Formatter *f) : f(f) {} + explicit DumpVisitor(Formatter *f) : f(f) {} void append(uint64_t old_size) { f->open_object_section("op"); f->dump_string("code", "APPEND"); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 1134ffd542f9..5b1330608c1b 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -717,7 +717,7 @@ public: epoch(ce.epoch), __pad(0) { } - eversion_t(bufferlist& bl) : __pad(0) { decode(bl); } + explicit eversion_t(bufferlist& bl) : __pad(0) { decode(bl); } static eversion_t max() { eversion_t max; @@ -1939,7 +1939,7 @@ struct pg_hit_set_info_t { utime_t begin, end; ///< time interval eversion_t version; ///< version this HitSet object was written bool using_gmt; ///< use gmt for creating the hit_set archive object name - pg_hit_set_info_t(bool using_gmt = true) + explicit pg_hit_set_info_t(bool using_gmt = true) : using_gmt(using_gmt) {} void encode(bufferlist &bl) const; @@ -2716,7 +2716,7 @@ struct pg_missing_t { struct item { eversion_t need, have; item() {} - item(eversion_t n) : need(n) {} // have no old version + explicit item(eversion_t n) : need(n) {} // have no old version item(eversion_t n, eversion_t h) : need(n), have(h) {} void encode(bufferlist& bl) const { @@ -3108,7 +3108,7 @@ struct SnapSet { map clone_size; SnapSet() : seq(0), head_exists(false) {} - SnapSet(bufferlist& bl) { + explicit SnapSet(bufferlist& bl) { bufferlist::iterator p = bl.begin(); decode(p); } @@ -3332,14 +3332,14 @@ struct object_info_t { data_digest(-1), omap_digest(-1) {} - object_info_t(const hobject_t& s) + explicit object_info_t(const hobject_t& s) : soid(s), user_version(0), size(0), flags((flag_t)0), truncate_seq(0), truncate_size(0), data_digest(-1), omap_digest(-1) {} - object_info_t(bufferlist& bl) { + explicit object_info_t(bufferlist& bl) { decode(bl); } object_info_t operator=(bufferlist& bl) { @@ -3366,7 +3366,7 @@ struct SnapSetContext { bool registered : 1; bool exists : 1; - SnapSetContext(const hobject_t& o) : + explicit SnapSetContext(const hobject_t& o) : oid(o), ref(0), registered(false), exists(true) { } }; diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index 02f93d35ae4d..f2dd275aff08 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -103,7 +103,7 @@ class Journaler::C_ReadHead : public Context { Journaler *ls; public: bufferlist bl; - C_ReadHead(Journaler *l) : ls(l) {} + explicit C_ReadHead(Journaler *l) : ls(l) {} void finish(int r) { ls->_finish_read_head(r, bl); } @@ -125,7 +125,7 @@ class Journaler::C_ProbeEnd : public Context { Journaler *ls; public: uint64_t end; - C_ProbeEnd(Journaler *l) : ls(l), end(-1) {} + explicit C_ProbeEnd(Journaler *l) : ls(l), end(-1) {} void finish(int r) { ls->_finish_probe_end(r, end); } @@ -849,7 +849,8 @@ public: class Journaler::C_RetryRead : public Context { Journaler *ls; public: - C_RetryRead(Journaler *l) : ls(l) {} + explicit C_RetryRead(Journaler *l) : ls(l) {} + void finish(int r) { // Should only be called from waitfor_safe i.e. already inside lock assert(ls->lock.is_locked_by_me()); diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index 791412ee7f19..b2ec73d20f52 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -130,7 +130,7 @@ class ObjectCacher { map > waitfor_read; // cons - BufferHead(Object *o) : + explicit BufferHead(Object *o) : state(STATE_MISSING), ref(0), dontneed(false), @@ -424,7 +424,7 @@ class ObjectCacher { class FlusherThread : public Thread { ObjectCacher *oc; public: - FlusherThread(ObjectCacher *o) : oc(o) {} + explicit FlusherThread(ObjectCacher *o) : oc(o) {} void *entry() { oc->flusher_entry(); return 0; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 16d8c0af8b5f..a8bfbdb031a9 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1142,7 +1142,7 @@ private: class RequestStateHook : public AdminSocketHook { Objecter *m_objecter; public: - RequestStateHook(Objecter *objecter); + explicit RequestStateHook(Objecter *objecter); bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& out); }; diff --git a/src/rbd_replay/ActionTypes.cc b/src/rbd_replay/ActionTypes.cc index e879384343a9..dc5388f241ed 100644 --- a/src/rbd_replay/ActionTypes.cc +++ b/src/rbd_replay/ActionTypes.cc @@ -36,7 +36,7 @@ void decode_big_endian_string(std::string &str, bufferlist::iterator &it) { class EncodeVisitor : public boost::static_visitor { public: - EncodeVisitor(bufferlist &bl) : m_bl(bl) { + explicit EncodeVisitor(bufferlist &bl) : m_bl(bl) { } template @@ -65,7 +65,7 @@ private: class DumpVisitor : public boost::static_visitor { public: - DumpVisitor(Formatter *formatter) : m_formatter(formatter) {} + explicit DumpVisitor(Formatter *formatter) : m_formatter(formatter) {} template inline void operator()(const Action &action) const { diff --git a/src/rbd_replay/Replayer.hpp b/src/rbd_replay/Replayer.hpp index acad7258fccd..5cb5ee57eeb4 100644 --- a/src/rbd_replay/Replayer.hpp +++ b/src/rbd_replay/Replayer.hpp @@ -77,7 +77,7 @@ private: class Replayer { public: - Replayer(int num_action_trackers); + explicit Replayer(int num_action_trackers); ~Replayer(); diff --git a/src/rbd_replay/actions.hpp b/src/rbd_replay/actions.hpp index 9f0acec90c3e..eec655a3bd7e 100644 --- a/src/rbd_replay/actions.hpp +++ b/src/rbd_replay/actions.hpp @@ -124,7 +124,7 @@ public: template class TypedAction : public Action { public: - TypedAction(const ActionType &action) : m_action(action) { + explicit TypedAction(const ActionType &action) : m_action(action) { } virtual action_id_t id() const { @@ -193,7 +193,7 @@ protected: class AioReadAction : public TypedAction { public: - AioReadAction(const action::AioReadAction &action) + explicit AioReadAction(const action::AioReadAction &action) : TypedAction(action) { } @@ -208,7 +208,7 @@ protected: class ReadAction : public TypedAction { public: - ReadAction(const action::ReadAction &action) + explicit ReadAction(const action::ReadAction &action) : TypedAction(action) { } @@ -223,7 +223,7 @@ protected: class AioWriteAction : public TypedAction { public: - AioWriteAction(const action::AioWriteAction &action) + explicit AioWriteAction(const action::AioWriteAction &action) : TypedAction(action) { } @@ -238,7 +238,7 @@ protected: class WriteAction : public TypedAction { public: - WriteAction(const action::WriteAction &action) + explicit WriteAction(const action::WriteAction &action) : TypedAction(action) { } @@ -253,7 +253,7 @@ protected: class OpenImageAction : public TypedAction { public: - OpenImageAction(const action::OpenImageAction &action) + explicit OpenImageAction(const action::OpenImageAction &action) : TypedAction(action) { } @@ -268,7 +268,7 @@ protected: class CloseImageAction : public TypedAction { public: - CloseImageAction(const action::CloseImageAction &action) + explicit CloseImageAction(const action::CloseImageAction &action) : TypedAction(action) { } @@ -282,7 +282,7 @@ protected: class AioOpenImageAction : public TypedAction { public: - AioOpenImageAction(const action::AioOpenImageAction &action) + explicit AioOpenImageAction(const action::AioOpenImageAction &action) : TypedAction(action) { } @@ -297,7 +297,7 @@ protected: class AioCloseImageAction : public TypedAction { public: - AioCloseImageAction(const action::AioCloseImageAction &action) + explicit AioCloseImageAction(const action::AioCloseImageAction &action) : TypedAction(action) { } diff --git a/src/rgw/rgw_acl.h b/src/rgw/rgw_acl.h index fc2a7ef28de2..fe7249c3c1e0 100644 --- a/src/rgw/rgw_acl.h +++ b/src/rgw/rgw_acl.h @@ -195,7 +195,7 @@ protected: multimap grant_map; void _add_grant(ACLGrant *grant); public: - RGWAccessControlList(CephContext *_cct) : cct(_cct) {} + explicit RGWAccessControlList(CephContext *_cct) : cct(_cct) {} RGWAccessControlList() : cct(NULL) {} void set_ctx(CephContext *ctx) { @@ -293,7 +293,7 @@ protected: ACLOwner owner; public: - RGWAccessControlPolicy(CephContext *_cct) : cct(_cct), acl(_cct) {} + explicit RGWAccessControlPolicy(CephContext *_cct) : cct(_cct), acl(_cct) {} RGWAccessControlPolicy() : cct(NULL), acl(NULL) {} virtual ~RGWAccessControlPolicy() {} diff --git a/src/rgw/rgw_acl_s3.h b/src/rgw/rgw_acl_s3.h index 694cc1d4a070..a21417ddaeaa 100644 --- a/src/rgw/rgw_acl_s3.h +++ b/src/rgw/rgw_acl_s3.h @@ -57,7 +57,7 @@ public: class RGWAccessControlList_S3 : public RGWAccessControlList, public XMLObj { public: - RGWAccessControlList_S3(CephContext *_cct) : RGWAccessControlList(_cct) {} + explicit RGWAccessControlList_S3(CephContext *_cct) : RGWAccessControlList(_cct) {} ~RGWAccessControlList_S3() {} bool xml_end(const char *el); @@ -82,7 +82,7 @@ class RGWEnv; class RGWAccessControlPolicy_S3 : public RGWAccessControlPolicy, public XMLObj { public: - RGWAccessControlPolicy_S3(CephContext *_cct) : RGWAccessControlPolicy(_cct) {} + explicit RGWAccessControlPolicy_S3(CephContext *_cct) : RGWAccessControlPolicy(_cct) {} ~RGWAccessControlPolicy_S3() {} bool xml_end(const char *el); @@ -110,7 +110,7 @@ class RGWACLXMLParser_S3 : public RGWXMLParser XMLObj *alloc_obj(const char *el); public: - RGWACLXMLParser_S3(CephContext *_cct) : cct(_cct) {} + explicit RGWACLXMLParser_S3(CephContext *_cct) : cct(_cct) {} }; #endif diff --git a/src/rgw/rgw_acl_swift.h b/src/rgw/rgw_acl_swift.h index cbadfaa6884a..ba72d7b914dc 100644 --- a/src/rgw/rgw_acl_swift.h +++ b/src/rgw/rgw_acl_swift.h @@ -16,7 +16,7 @@ using namespace std; class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy { public: - RGWAccessControlPolicy_SWIFT(CephContext *_cct) : RGWAccessControlPolicy(_cct) {} + explicit RGWAccessControlPolicy_SWIFT(CephContext *_cct) : RGWAccessControlPolicy(_cct) {} ~RGWAccessControlPolicy_SWIFT() {} void add_grants(RGWRados *store, list& uids, int perm); diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index c9365fabfe17..9e92234b0c2e 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -625,7 +625,7 @@ int bucket_stats(rgw_bucket& bucket, Formatter *formatter) class StoreDestructor { RGWRados *store; public: - StoreDestructor(RGWRados *_s) : store(_s) {} + explicit StoreDestructor(RGWRados *_s) : store(_s) {} ~StoreDestructor() { RGWStoreManager::close_storage(store); } diff --git a/src/rgw/rgw_client_io.h b/src/rgw/rgw_client_io.h index 46e6684930ce..ac610c6215f3 100644 --- a/src/rgw/rgw_client_io.h +++ b/src/rgw/rgw_client_io.h @@ -107,7 +107,7 @@ class RGWClientIOStream : private RGWClientIOStreamBuf, public std::istream { * ctor is being called prior to construction of any member of this class. */ public: - RGWClientIOStream(RGWClientIO &c) + explicit RGWClientIOStream(RGWClientIO &c) : RGWClientIOStreamBuf(c, 1, 2), istream(static_cast(this)) { } diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 823c0cb819fb..302767eb14c5 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -260,7 +260,7 @@ class NameVal string name; string val; public: - NameVal(string nv) : str(nv) {} + explicit NameVal(string nv) : str(nv) {} int parse(); @@ -1183,11 +1183,11 @@ struct RGWBucketEnt { RGWBucketEnt() : size(0), size_rounded(0), creation_time(0), count(0) {} - RGWBucketEnt(const cls_user_bucket_entry& e) : bucket(e.bucket), - size(e.size), - size_rounded(e.size_rounded), - creation_time(e.creation_time), - count(e.count) {} + explicit RGWBucketEnt(const cls_user_bucket_entry& e) : bucket(e.bucket), + size(e.size), + size_rounded(e.size_rounded), + creation_time(e.creation_time), + count(e.count) {} void convert(cls_user_bucket_entry *b) { bucket.convert(&b->bucket); diff --git a/src/rgw/rgw_cors_s3.h b/src/rgw/rgw_cors_s3.h index 3a9616006959..818d02ffb470 100644 --- a/src/rgw/rgw_cors_s3.h +++ b/src/rgw/rgw_cors_s3.h @@ -53,6 +53,6 @@ class RGWCORSXMLParser_S3 : public RGWXMLParser XMLObj *alloc_obj(const char *el); public: - RGWCORSXMLParser_S3(CephContext *_cct) : cct(_cct) {} + explicit RGWCORSXMLParser_S3(CephContext *_cct) : cct(_cct) {} }; #endif /*CEPH_RGW_CORS_S3_H*/ diff --git a/src/rgw/rgw_fcgi.h b/src/rgw/rgw_fcgi.h index 88889b5085a0..92171f4780d2 100644 --- a/src/rgw/rgw_fcgi.h +++ b/src/rgw/rgw_fcgi.h @@ -27,7 +27,7 @@ protected: int complete_request() { return 0; } int send_content_length(uint64_t len); public: - RGWFCGX(FCGX_Request *_fcgx) : fcgx(_fcgx), status_num(0) {} + explicit RGWFCGX(FCGX_Request *_fcgx) : fcgx(_fcgx), status_num(0) {} void flush(); }; diff --git a/src/rgw/rgw_formats.h b/src/rgw/rgw_formats.h index 9ce841a55481..9df5251fb19a 100644 --- a/src/rgw/rgw_formats.h +++ b/src/rgw/rgw_formats.h @@ -22,7 +22,7 @@ struct plain_stack_entry { class RGWFormatter_Plain : public Formatter { void reset_buf(); public: - RGWFormatter_Plain(bool use_kv = false); + explicit RGWFormatter_Plain(bool use_kv = false); virtual ~RGWFormatter_Plain(); virtual void set_status(int status, const char* status_name) {}; @@ -69,7 +69,7 @@ protected: formatter = f; } public: - RGWFormatterFlusher(Formatter *f) : formatter(f), flushed(false), started(false) {} + explicit RGWFormatterFlusher(Formatter *f) : formatter(f), flushed(false), started(false) {} virtual ~RGWFormatterFlusher() {} void flush() { diff --git a/src/rgw/rgw_http_client.h b/src/rgw/rgw_http_client.h index 9e0e314db385..705b848d1fbc 100644 --- a/src/rgw/rgw_http_client.h +++ b/src/rgw/rgw_http_client.h @@ -18,7 +18,7 @@ protected: list > headers; public: virtual ~RGWHTTPClient() {} - RGWHTTPClient(CephContext *_cct): send_len (0), has_send_len(false), cct(_cct) {} + explicit RGWHTTPClient(CephContext *_cct): send_len (0), has_send_len(false), cct(_cct) {} void append_header(const string& name, const string& val) { headers.push_back(pair(name, val)); diff --git a/src/rgw/rgw_loadgen.h b/src/rgw/rgw_loadgen.h index e5636ed380cd..87513157c346 100644 --- a/src/rgw/rgw_loadgen.h +++ b/src/rgw/rgw_loadgen.h @@ -40,7 +40,7 @@ public: int complete_request(); int send_content_length(uint64_t len); - RGWLoadGenIO(RGWLoadGenRequestEnv *_re) : left_to_read(0), req(_re) {} + explicit RGWLoadGenIO(RGWLoadGenRequestEnv *_re) : left_to_read(0), req(_re) {} void flush(); }; diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 8f85fdec17fb..c600386f4b32 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -95,7 +95,7 @@ class UsageLogger { class C_UsageLogTimeout : public Context { UsageLogger *logger; public: - C_UsageLogTimeout(UsageLogger *_l) : logger(_l) {} + explicit C_UsageLogTimeout(UsageLogger *_l) : logger(_l) {} void finish(int r) { logger->flush(); logger->set_timer(); diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 181d943c921a..e04202a9fae2 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -96,7 +96,7 @@ struct RGWRequest RGWOp *op; utime_t ts; - RGWRequest(uint64_t id) : id(id), s(NULL), op(NULL) { + explicit RGWRequest(uint64_t id) : id(id), s(NULL), op(NULL) { } virtual ~RGWRequest() {} @@ -139,7 +139,7 @@ class RGWFrontendConfig { int parse_config(const string& config, map& config_map); string framework; public: - RGWFrontendConfig(const string& _conf) : config(_conf) {} + explicit RGWFrontendConfig(const string& _conf) : config(_conf) {} int init() { int ret = parse_config(config, config_map); if (ret < 0) @@ -901,7 +901,7 @@ public: class RGWProcessControlThread : public Thread { RGWProcess *pprocess; public: - RGWProcessControlThread(RGWProcess *_pprocess) : pprocess(_pprocess) {} + explicit RGWProcessControlThread(RGWProcess *_pprocess) : pprocess(_pprocess) {} void *entry() { pprocess->run(); diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index 80ed8224e6d5..783cc6155d18 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -13,7 +13,7 @@ struct LogStatusDump { RGWMDLogStatus status; - LogStatusDump(RGWMDLogStatus _status) : status(_status) {} + explicit LogStatusDump(RGWMDLogStatus _status) : status(_status) {} void dump(Formatter *f) const { string s; switch (status) { diff --git a/src/rgw/rgw_object_expirer.cc b/src/rgw/rgw_object_expirer.cc index dcbfbc1d3a43..ae7424d35a5b 100644 --- a/src/rgw/rgw_object_expirer.cc +++ b/src/rgw/rgw_object_expirer.cc @@ -41,7 +41,7 @@ class StoreDestructor { RGWRados *store; public: - StoreDestructor(RGWRados *_s) : store(_s) {} + explicit StoreDestructor(RGWRados *_s) : store(_s) {} ~StoreDestructor() { if (store) { RGWStoreManager::close_storage(store); diff --git a/src/rgw/rgw_object_expirer_core.h b/src/rgw/rgw_object_expirer_core.h index c9d56da2eeb9..284dc14df8d4 100644 --- a/src/rgw/rgw_object_expirer_core.h +++ b/src/rgw/rgw_object_expirer_core.h @@ -62,7 +62,7 @@ protected: atomic_t down_flag; public: - RGWObjectExpirer(RGWRados *_store) + explicit RGWObjectExpirer(RGWRados *_store) : store(_store) {} diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 148e75093e8b..254fbd4f5f70 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -207,7 +207,7 @@ class RGWGetObj_CB : public RGWGetDataCB { RGWGetObj *op; public: - RGWGetObj_CB(RGWGetObj *_op) : op(_op) {} + explicit RGWGetObj_CB(RGWGetObj *_op) : op(_op) {} virtual ~RGWGetObj_CB() {} int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) { diff --git a/src/rgw/rgw_orphan.h b/src/rgw/rgw_orphan.h index 9b70508e941f..8d5086621d6d 100644 --- a/src/rgw/rgw_orphan.h +++ b/src/rgw/rgw_orphan.h @@ -43,7 +43,7 @@ struct RGWOrphanSearchStage { string marker; RGWOrphanSearchStage() : stage(ORPHAN_SEARCH_STAGE_UNKNOWN), shard(0) {} - RGWOrphanSearchStage(RGWOrphanSearchStageId _stage) : stage(_stage), shard(0) {} + explicit RGWOrphanSearchStage(RGWOrphanSearchStageId _stage) : stage(_stage), shard(0) {} RGWOrphanSearchStage(RGWOrphanSearchStageId _stage, int _shard, const string& _marker) : stage(_stage), shard(_shard), marker(_marker) {} void encode(bufferlist& bl) const { @@ -127,7 +127,7 @@ class RGWOrphanStore { string oid; public: - RGWOrphanStore(RGWRados *_store) : store(_store), oid(RGW_ORPHAN_INDEX_OID) {} + explicit RGWOrphanStore(RGWRados *_store) : store(_store), oid(RGW_ORPHAN_INDEX_OID) {} librados::IoCtx& get_ioctx() { return ioctx; } diff --git a/src/rgw/rgw_quota.cc b/src/rgw/rgw_quota.cc index c300c4432a00..c6c62e7b7b9c 100644 --- a/src/rgw/rgw_quota.cc +++ b/src/rgw/rgw_quota.cc @@ -306,7 +306,7 @@ protected: int fetch_stats_from_storage(const rgw_user& user, rgw_bucket& bucket, RGWStorageStats& stats); public: - RGWBucketStatsCache(RGWRados *_store) : RGWQuotaCache(_store, _store->ctx()->_conf->rgw_bucket_quota_cache_size) { + explicit RGWBucketStatsCache(RGWRados *_store) : RGWQuotaCache(_store, _store->ctx()->_conf->rgw_bucket_quota_cache_size) { } AsyncRefreshHandler *allocate_refresh_handler(const rgw_user& user, rgw_bucket& bucket) { diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index c6f99ca0afef..a75b69e89fda 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1300,7 +1300,7 @@ class RGWWatcher : public librados::WatchCtx2 { class C_ReinitWatch : public Context { RGWWatcher *watcher; public: - C_ReinitWatch(RGWWatcher *_watcher) : watcher(_watcher) {} + explicit C_ReinitWatch(RGWWatcher *_watcher) : watcher(_watcher) {} void finish(int r) { watcher->reinit(); } @@ -6121,7 +6121,7 @@ struct get_obj_data : public RefCountedObject { Throttle throttle; list read_list; - get_obj_data(CephContext *_cct) + explicit get_obj_data(CephContext *_cct) : cct(_cct), rados(NULL), ctx(NULL), total_read(0), lock("get_obj_data"), data_lock("get_obj_data::data_lock"), @@ -7421,7 +7421,7 @@ class RGWGetUserStatsContext : public RGWGetUserHeader_CB { RGWGetUserStats_CB *cb; public: - RGWGetUserStatsContext(RGWGetUserStats_CB *_cb) : cb(_cb) {} + explicit RGWGetUserStatsContext(RGWGetUserStats_CB *_cb) : cb(_cb) {} void handle_response(int r, cls_user_header& header) { cls_user_stats& hs = header.stats; if (r >= 0) { @@ -7942,7 +7942,7 @@ int RGWRados::pool_iterate(RGWPoolIterCtx& ctx, uint32_t num, vector& struct RGWAccessListFilterPrefix : public RGWAccessListFilter { string prefix; - RGWAccessListFilterPrefix(const string& _prefix) : prefix(_prefix) {} + explicit RGWAccessListFilterPrefix(const string& _prefix) : prefix(_prefix) {} virtual bool filter(string& name, string& key) { return (prefix.compare(key.substr(0, prefix.size())) == 0); } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index f57d34f86bc1..cb3c880cfa2b 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -464,7 +464,7 @@ public: obj_iterator() : manifest(NULL) { init(); } - obj_iterator(RGWObjManifest *_m) : manifest(_m) { + explicit obj_iterator(RGWObjManifest *_m) : manifest(_m) { init(); if (!manifest->empty()) { seek(0); @@ -1130,7 +1130,7 @@ public: OPSTATE_CANCELLED = 5, }; - RGWOpState(RGWRados *_store); + explicit RGWOpState(RGWRados *_store); int state_from_str(const string& s, OpState *state); int set_state(const string& client_id, const string& op_id, const string& object, OpState state); @@ -1161,7 +1161,7 @@ protected: rgw_bucket bucket; map *stats; public: - RGWGetBucketStats_CB(rgw_bucket& _bucket) : bucket(_bucket), stats(NULL) {} + explicit RGWGetBucketStats_CB(rgw_bucket& _bucket) : bucket(_bucket), stats(NULL) {} virtual ~RGWGetBucketStats_CB() {} virtual void handle_response(int r) = 0; virtual void set_response(map *_stats) { @@ -1174,7 +1174,7 @@ protected: rgw_user user; RGWStorageStats stats; public: - RGWGetUserStats_CB(const rgw_user& _user) : user(_user) {} + explicit RGWGetUserStats_CB(const rgw_user& _user) : user(_user) {} virtual ~RGWGetUserStats_CB() {} virtual void handle_response(int r) = 0; virtual void set_response(RGWStorageStats& _stats) { @@ -1213,7 +1213,7 @@ struct RGWObjectCtx { map objs_state; void *user_ctx; - RGWObjectCtx(RGWRados *_store) : store(_store), user_ctx(NULL) { } + explicit RGWObjectCtx(RGWRados *_store) : store(_store), user_ctx(NULL) { } RGWObjectCtx(RGWRados *_store, void *_user_ctx) : store(_store), user_ctx(_user_ctx) { } RGWObjState *get_state(rgw_obj& obj); @@ -1264,7 +1264,7 @@ class RGWRados class C_Tick : public Context { RGWRados *rados; public: - C_Tick(RGWRados *_r) : rados(_r) {} + explicit C_Tick(RGWRados *_r) : rados(_r) {} void finish(int r) { rados->tick(); } @@ -1509,7 +1509,7 @@ public: rgw_cache_entry_info *cache_info; } read_params; - Read(RGWRados::SystemObject *_source) : source(_source) {} + explicit Read(RGWRados::SystemObject *_source) : source(_source) {} int stat(RGWObjVersionTracker *objv_tracker); int read(int64_t ofs, int64_t end, bufferlist& bl, RGWObjVersionTracker *objv_tracker); @@ -1524,7 +1524,7 @@ public: librados::IoCtx index_ctx; string bucket_obj; - BucketShard(RGWRados *_store) : store(_store), shard_id(-1) {} + explicit BucketShard(RGWRados *_store) : store(_store), shard_id(-1) {} int init(rgw_bucket& _bucket, rgw_obj& obj); }; @@ -1609,7 +1609,7 @@ public: Params() : lastmod(NULL), read_size(NULL), obj_size(NULL), attrs(NULL), perr(NULL) {} } params; - Read(RGWRados::Object *_source) : source(_source) {} + explicit Read(RGWRados::Object *_source) : source(_source) {} int prepare(int64_t *pofs, int64_t *pend); int read(int64_t ofs, int64_t end, bufferlist& bl); @@ -1641,7 +1641,7 @@ public: if_match(NULL), if_nomatch(NULL), olh_epoch(0), delete_at(0) {} } meta; - Write(RGWRados::Object *_target) : target(_target) {} + explicit Write(RGWRados::Object *_target) : target(_target) {} int write_meta(uint64_t size, map& attrs); int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive); @@ -1670,7 +1670,7 @@ public: DeleteResult() : delete_marker(false) {} } result; - Delete(RGWRados::Object *_target) : target(_target) {} + explicit Delete(RGWRados::Object *_target) : target(_target) {} int delete_obj(); }; @@ -1698,7 +1698,7 @@ public: } state; - Stat(RGWRados::Object *_source) : source(_source) {} + explicit Stat(RGWRados::Object *_source) : source(_source) {} int stat_async(); int wait(); @@ -1775,7 +1775,7 @@ public: } params; public: - List(RGWRados::Bucket *_target) : target(_target) {} + explicit List(RGWRados::Bucket *_target) : target(_target) {} int list_objects(int max, vector *result, map *common_prefixes, bool *is_truncated); rgw_obj_key& get_next_marker() { diff --git a/src/rgw/rgw_replica_log.h b/src/rgw/rgw_replica_log.h index 9ea3982ee559..794a5d913916 100644 --- a/src/rgw/rgw_replica_log.h +++ b/src/rgw/rgw_replica_log.h @@ -45,7 +45,7 @@ protected: RGWRados *store; int open_ioctx(librados::IoCtx& ctx, const string& pool); - RGWReplicaLogger(RGWRados *_store); + explicit RGWReplicaLogger(RGWRados *_store); int update_bound(const string& oid, const string& pool, const string& daemon_id, const string& marker, @@ -105,7 +105,7 @@ class RGWReplicaBucketLogger : private RGWReplicaLogger { string obj_name(const rgw_bucket& bucket, int shard_id, bool index_by_instance); public: - RGWReplicaBucketLogger(RGWRados *_store); + explicit RGWReplicaBucketLogger(RGWRados *_store); int update_bound(const rgw_bucket& bucket, int shard_id, const string& daemon_id, const string& marker, const utime_t& time, const list *entries); diff --git a/src/rgw/rgw_rest_client.cc b/src/rgw/rgw_rest_client.cc index 4eaf42e8ac6a..4ca88abbc8b8 100644 --- a/src/rgw/rgw_rest_client.cc +++ b/src/rgw/rgw_rest_client.cc @@ -272,7 +272,7 @@ int RGWRESTSimpleRequest::forward_request(RGWAccessKey& key, req_info& info, siz class RGWRESTStreamOutCB : public RGWGetDataCB { RGWRESTStreamWriteRequest *req; public: - RGWRESTStreamOutCB(RGWRESTStreamWriteRequest *_req) : req(_req) {} + explicit RGWRESTStreamOutCB(RGWRESTStreamWriteRequest *_req) : req(_req) {} int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len); /* callback for object iteration when sending data */ }; diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index f15d6491a939..e278ad2d3cf7 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -53,7 +53,7 @@ int RGWRESTConn::forward(const rgw_user& uid, req_info& info, obj_version *objv, class StreamObjData : public RGWGetDataCB { rgw_obj obj; public: - StreamObjData(rgw_obj& _obj) : obj(_obj) {} + explicit StreamObjData(rgw_obj& _obj) : obj(_obj) {} }; int RGWRESTConn::put_obj_init(const rgw_user& uid, rgw_obj& obj, uint64_t obj_size, diff --git a/src/rgw/rgw_rest_s3.h b/src/rgw/rgw_rest_s3.h index 9e7d15b20275..ada556290f77 100644 --- a/src/rgw/rgw_rest_s3.h +++ b/src/rgw/rgw_rest_s3.h @@ -351,7 +351,7 @@ private: } public: - RGW_Auth_S3_Keystone_ValidateToken(CephContext *_cct) + explicit RGW_Auth_S3_Keystone_ValidateToken(CephContext *_cct) : RGWHTTPClient(_cct) { get_str_list(cct->_conf->rgw_keystone_accepted_roles, roles_list); } @@ -493,7 +493,7 @@ class RGWRESTMgr_S3 : public RGWRESTMgr { private: bool enable_s3website; public: - RGWRESTMgr_S3(bool enable_s3website) : enable_s3website(false) { this->enable_s3website = enable_s3website; } + explicit RGWRESTMgr_S3(bool enable_s3website) : enable_s3website(false) { this->enable_s3website = enable_s3website; } virtual ~RGWRESTMgr_S3() {} virtual RGWHandler *get_handler(struct req_state *s); diff --git a/src/rgw/rgw_rest_s3website.h b/src/rgw/rgw_rest_s3website.h index 06a22ccda22d..d6cd7d8b0810 100644 --- a/src/rgw/rgw_rest_s3website.h +++ b/src/rgw/rgw_rest_s3website.h @@ -73,7 +73,7 @@ private: bool is_errordoc_request; public: RGWGetObj_ObjStore_S3Website() : is_errordoc_request(false) {} - RGWGetObj_ObjStore_S3Website(bool is_errordoc_request) : is_errordoc_request(false) { this->is_errordoc_request = is_errordoc_request; } + explicit RGWGetObj_ObjStore_S3Website(bool is_errordoc_request) : is_errordoc_request(false) { this->is_errordoc_request = is_errordoc_request; } ~RGWGetObj_ObjStore_S3Website() {} int send_response_data_error(); int send_response_data(bufferlist& bl, off_t ofs, off_t len); diff --git a/src/rgw/rgw_rest_user.cc b/src/rgw/rgw_rest_user.cc index 6086e763fdab..46132b0582a3 100644 --- a/src/rgw/rgw_rest_user.cc +++ b/src/rgw/rgw_rest_user.cc @@ -646,7 +646,7 @@ struct UserQuotas { UserQuotas() {} - UserQuotas(RGWUserInfo& info) : bucket_quota(info.bucket_quota), + explicit UserQuotas(RGWUserInfo& info) : bucket_quota(info.bucket_quota), user_quota(info.user_quota) {} void dump(Formatter *f) const { diff --git a/src/rgw/rgw_swift.h b/src/rgw/rgw_swift.h index 8a081aaa1a15..ff449e91b9e4 100644 --- a/src/rgw/rgw_swift.h +++ b/src/rgw/rgw_swift.h @@ -61,7 +61,7 @@ protected: int check_revoked(); public: - RGWSwift(CephContext *_cct) : cct(_cct), keystone_revoke_thread(NULL) { + explicit RGWSwift(CephContext *_cct) : cct(_cct), keystone_revoke_thread(NULL) { init(); } ~RGWSwift() { diff --git a/src/rgw/rgw_user.h b/src/rgw/rgw_user.h index 57d40faaf306..bff4a52912e8 100644 --- a/src/rgw/rgw_user.h +++ b/src/rgw/rgw_user.h @@ -526,7 +526,7 @@ private: int add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save); int remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save); public: - RGWAccessKeyPool(RGWUser* usr); + explicit RGWAccessKeyPool(RGWUser* usr); ~RGWAccessKeyPool(); int init(RGWUserAdminOpState& op_state); @@ -561,7 +561,7 @@ private: int remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save); int modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save); public: - RGWSubUserPool(RGWUser *user); + explicit RGWSubUserPool(RGWUser *user); ~RGWSubUserPool(); bool exists(std::string subuser); @@ -586,7 +586,7 @@ private: int remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save); public: - RGWUserCapPool(RGWUser *user); + explicit RGWUserCapPool(RGWUser *user); ~RGWUserCapPool(); int init(RGWUserAdminOpState& op_state); diff --git a/src/rgw/rgw_xml.h b/src/rgw/rgw_xml.h index 661e97cc77e9..21f03731a6f4 100644 --- a/src/rgw/rgw_xml.h +++ b/src/rgw/rgw_xml.h @@ -95,7 +95,7 @@ public: struct err { string message; - err(const string& m) : message(m) {} + explicit err(const string& m) : message(m) {} }; class XMLParser : public RGWXMLParser { @@ -104,7 +104,7 @@ public: virtual ~XMLParser() {} } parser; - RGWXMLDecoder(bufferlist& bl) { + explicit RGWXMLDecoder(bufferlist& bl) { if (!parser.parse(bl.c_str(), bl.length(), 1)) { cout << "RGWXMLDecoder::err()" << std::endl; throw RGWXMLDecoder::err("failed to parse XML input"); diff --git a/src/test/ObjectMap/KeyValueDBMemory.cc b/src/test/ObjectMap/KeyValueDBMemory.cc index fc59b7db3a0f..a99641f72f2c 100644 --- a/src/test/ObjectMap/KeyValueDBMemory.cc +++ b/src/test/ObjectMap/KeyValueDBMemory.cc @@ -26,7 +26,7 @@ protected: map, bufferlist>::iterator it; public: - WholeSpaceMemIterator(KeyValueDBMemory *db) : db(db), ready(false) { } + explicit WholeSpaceMemIterator(KeyValueDBMemory *db) : db(db), ready(false) { } virtual ~WholeSpaceMemIterator() { } int seek_to_first() { @@ -238,7 +238,7 @@ public: * keep it in mind. */ - WholeSpaceSnapshotMemIterator(KeyValueDBMemory *db) : + explicit WholeSpaceSnapshotMemIterator(KeyValueDBMemory *db) : WholeSpaceMemIterator(db) { } ~WholeSpaceSnapshotMemIterator() { delete db; diff --git a/src/test/ObjectMap/KeyValueDBMemory.h b/src/test/ObjectMap/KeyValueDBMemory.h index 563e7bdc32e8..0712fa0344a4 100644 --- a/src/test/ObjectMap/KeyValueDBMemory.h +++ b/src/test/ObjectMap/KeyValueDBMemory.h @@ -16,7 +16,7 @@ public: std::map,bufferlist> db; KeyValueDBMemory() { } - KeyValueDBMemory(KeyValueDBMemory *db) : db(db->db) { } + explicit KeyValueDBMemory(KeyValueDBMemory *db) : db(db->db) { } virtual ~KeyValueDBMemory() { } virtual int init(string _opt) { @@ -62,7 +62,7 @@ public: list on_commit; KeyValueDBMemory *db; - TransactionImpl_(KeyValueDBMemory *db) : db(db) {} + explicit TransactionImpl_(KeyValueDBMemory *db) : db(db) {} struct SetOp : public Context { diff --git a/src/test/TestTimers.cc b/src/test/TestTimers.cc index 0dc8a066e412..5e2b6b973956 100644 --- a/src/test/TestTimers.cc +++ b/src/test/TestTimers.cc @@ -26,7 +26,7 @@ namespace class TestContext : public Context { public: - TestContext(int num_) + explicit TestContext(int num_) : num(num_) { } @@ -50,7 +50,7 @@ protected: class StrictOrderTestContext : public TestContext { public: - StrictOrderTestContext (int num_) + explicit StrictOrderTestContext (int num_) : TestContext(num_) { } diff --git a/src/test/admin_socket.cc b/src/test/admin_socket.cc index cee215d2e96f..212d754f379d 100644 --- a/src/test/admin_socket.cc +++ b/src/test/admin_socket.cc @@ -30,7 +30,7 @@ class AdminSocketTest { public: - AdminSocketTest(AdminSocket *asokc) + explicit AdminSocketTest(AdminSocket *asokc) : m_asokc(asokc) { } diff --git a/src/test/bench/bencher.cc b/src/test/bench/bencher.cc index aebe729a72a2..90f888d77936 100644 --- a/src/test/bench/bencher.cc +++ b/src/test/bench/bencher.cc @@ -10,7 +10,7 @@ template struct C_Holder : public Context { T obj; - C_Holder( + explicit C_Holder( T obj) : obj(obj) {} void finish(int r) { @@ -20,13 +20,13 @@ struct C_Holder : public Context { struct OnDelete { Context *c; - OnDelete(Context *c) : c(c) {} + explicit OnDelete(Context *c) : c(c) {} ~OnDelete() { c->complete(0); } }; struct Cleanup : public Context { Bencher *bench; - Cleanup(Bencher *bench) : bench(bench) {} + explicit Cleanup(Bencher *bench) : bench(bench) {} void finish(int r) { bench->complete_op(); } diff --git a/src/test/bench/distribution.h b/src/test/bench/distribution.h index d3525b8b66cc..545195fc8b43 100644 --- a/src/test/bench/distribution.h +++ b/src/test/bench/distribution.h @@ -127,7 +127,7 @@ public: class Uniform : public Distribution { uint64_t val; public: - Uniform(uint64_t val) : val(val) {} + explicit Uniform(uint64_t val) : val(val) {} virtual uint64_t operator()() { return val; } diff --git a/src/test/bench/dumb_backend.h b/src/test/bench/dumb_backend.h index 38e160db76f7..203ddf298364 100644 --- a/src/test/bench/dumb_backend.h +++ b/src/test/bench/dumb_backend.h @@ -42,7 +42,7 @@ class DumbBackend : public Backend { class SyncThread : public Thread { DumbBackend *backend; public: - SyncThread(DumbBackend *backend) : backend(backend) {} + explicit SyncThread(DumbBackend *backend) : backend(backend) {} void *entry() { backend->sync_loop(); return 0; diff --git a/src/test/bench/rados_backend.h b/src/test/bench/rados_backend.h index 911d6c7d487f..a607ae7c8cc5 100644 --- a/src/test/bench/rados_backend.h +++ b/src/test/bench/rados_backend.h @@ -10,7 +10,7 @@ class RadosBackend : public Backend { librados::IoCtx *ioctx; public: - RadosBackend( + explicit RadosBackend( librados::IoCtx *ioctx) : ioctx(ioctx) {} void write( diff --git a/src/test/bench/rbd_backend.h b/src/test/bench/rbd_backend.h index 9c3bc8bbc1c9..9994bc727b52 100644 --- a/src/test/bench/rbd_backend.h +++ b/src/test/bench/rbd_backend.h @@ -10,7 +10,7 @@ class RBDBackend : public Backend { map > *m_images; public: - RBDBackend(map > *images) + explicit RBDBackend(map > *images) : m_images(images) {} void write( const string &oid, diff --git a/src/test/bench/small_io_bench_fs.cc b/src/test/bench/small_io_bench_fs.cc index 75f0ded006c0..9466bd4d87a5 100644 --- a/src/test/bench/small_io_bench_fs.cc +++ b/src/test/bench/small_io_bench_fs.cc @@ -29,7 +29,7 @@ using namespace std; struct MorePrinting : public DetailedStatCollector::AdditionalPrinting { CephContext *cct; - MorePrinting(CephContext *cct) : cct(cct) {} + explicit MorePrinting(CephContext *cct) : cct(cct) {} void operator()(std::ostream *out) { bufferlist bl; Formatter *f = Formatter::create("json-pretty"); diff --git a/src/test/bench_log.cc b/src/test/bench_log.cc index a80e14a5e811..39e8813ae756 100644 --- a/src/test/bench_log.cc +++ b/src/test/bench_log.cc @@ -13,7 +13,7 @@ struct T : public Thread { int num; set myset; map mymap; - T(int n) : num(n) { + explicit T(int n) : num(n) { myset.insert(123); myset.insert(456); mymap[1] = "foo"; diff --git a/src/test/ceph_argparse.cc b/src/test/ceph_argparse.cc index f846db729189..c4f99c8ba112 100644 --- a/src/test/ceph_argparse.cc +++ b/src/test/ceph_argparse.cc @@ -27,7 +27,7 @@ class VectorContainer { public: - VectorContainer(const char** arr_) { + explicit VectorContainer(const char** arr_) { for (const char **a = arr_; *a; ++a) { const char *str = (const char*)strdup(*a); arr.push_back(str); diff --git a/src/test/common/ObjectContents.h b/src/test/common/ObjectContents.h index 768915957401..3892c75bb59d 100644 --- a/src/test/common/ObjectContents.h +++ b/src/test/common/ObjectContents.h @@ -29,7 +29,7 @@ public: private: unsigned int get_state(uint64_t pos); public: - Iterator(ObjectContents *parent) : + explicit Iterator(ObjectContents *parent) : parent(parent), iter(parent->seeds.end()), current_state(0), current_val(0), pos(-1) { seek_to_first(); @@ -77,7 +77,7 @@ public: seeds[0] = 0; } - ObjectContents(bufferlist::iterator &bp) { + explicit ObjectContents(bufferlist::iterator &bp) { ::decode(_size, bp); ::decode(seeds, bp); ::decode(written, bp); diff --git a/src/test/common/test_async_compressor.cc b/src/test/common/test_async_compressor.cc index 1655596d1a03..e80a499cb711 100644 --- a/src/test/common/test_async_compressor.cc +++ b/src/test/common/test_async_compressor.cc @@ -102,7 +102,7 @@ class SyntheticWorkload { static const uint64_t MAX_INFLIGHT = 128; public: - SyntheticWorkload(AsyncCompressor *ac): async_compressor(ac), rng(time(NULL)) { + explicit SyntheticWorkload(AsyncCompressor *ac): async_compressor(ac), rng(time(NULL)) { for (int i = 0; i < 100; i++) { bufferlist bl; boost::uniform_int<> u(4096, 1<<24); diff --git a/src/test/common/test_lru.cc b/src/test/common/test_lru.cc index 7483718f5f62..b3630792aef8 100644 --- a/src/test/common/test_lru.cc +++ b/src/test/common/test_lru.cc @@ -23,7 +23,7 @@ class Item : public LRUObject { public: int id; - Item(int v) : id(v) {} + explicit Item(int v) : id(v) {} }; diff --git a/src/test/common/test_prioritized_queue.cc b/src/test/common/test_prioritized_queue.cc index 00709a1ecbb2..0508e2aa5632 100644 --- a/src/test/common/test_prioritized_queue.cc +++ b/src/test/common/test_prioritized_queue.cc @@ -164,7 +164,7 @@ TEST_F(PrioritizedQueueTest, fairness_by_class) { template struct Greater { const T rhs; - Greater(const T& v) : rhs(v) + explicit Greater(const T& v) : rhs(v) {} bool operator()(const T& lhs) const { return lhs > rhs; diff --git a/src/test/compressor/compressor_plugin_example.cc b/src/test/compressor/compressor_plugin_example.cc index 96914ee58dd5..19135532a8f1 100644 --- a/src/test/compressor/compressor_plugin_example.cc +++ b/src/test/compressor/compressor_plugin_example.cc @@ -23,7 +23,7 @@ class CompressorPluginExample : public CompressionPlugin { public: - CompressorPluginExample(CephContext* cct) : CompressionPlugin(cct) + explicit CompressorPluginExample(CephContext* cct) : CompressionPlugin(cct) {} virtual int factory(CompressorRef *cs, diff --git a/src/test/encoding.cc b/src/test/encoding.cc index 4f2b26c52279..da4d6fb04ef0 100644 --- a/src/test/encoding.cc +++ b/src/test/encoding.cc @@ -69,7 +69,7 @@ public: default_ctor++; } - ConstructorCounter(const T& data_) + explicit ConstructorCounter(const T& data_) : data(data_) { one_arg_ctor++; diff --git a/src/test/librbd/test_ImageWatcher.cc b/src/test/librbd/test_ImageWatcher.cc index c816853ac4d8..7ae6643bc465 100644 --- a/src/test/librbd/test_ImageWatcher.cc +++ b/src/test/librbd/test_ImageWatcher.cc @@ -47,7 +47,7 @@ public: class WatchCtx : public librados::WatchCtx2 { public: - WatchCtx(TestImageWatcher &parent) : m_parent(parent), m_handle(0) {} + explicit WatchCtx(TestImageWatcher &parent) : m_parent(parent), m_handle(0) {} int watch(const librbd::ImageCtx &ictx) { m_header_oid = ictx.header_oid; diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index e8b21d6ee5c1..883bdad3e0ce 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -3316,7 +3316,7 @@ TEST_F(TestLibRBD, ResizeViaLockOwner) class RBDWriter : public Thread { public: - RBDWriter(librbd::Image &image) : m_image(image) {}; + explicit RBDWriter(librbd::Image &image) : m_image(image) {}; protected: void *entry() { librbd::image_info_t info; diff --git a/src/test/messenger/simple_dispatcher.h b/src/test/messenger/simple_dispatcher.h index e2397902906e..0c08003b7610 100644 --- a/src/test/messenger/simple_dispatcher.h +++ b/src/test/messenger/simple_dispatcher.h @@ -24,7 +24,7 @@ private: Messenger *messenger; uint64_t dcount; public: - SimpleDispatcher(Messenger *msgr); + explicit SimpleDispatcher(Messenger *msgr); virtual ~SimpleDispatcher(); uint64_t get_dcount() { return dcount; } diff --git a/src/test/messenger/xio_dispatcher.h b/src/test/messenger/xio_dispatcher.h index f8b76d3242be..29c71a0ba17a 100644 --- a/src/test/messenger/xio_dispatcher.h +++ b/src/test/messenger/xio_dispatcher.h @@ -24,7 +24,7 @@ private: Messenger *messenger; uint64_t dcount; public: - XioDispatcher(Messenger *msgr); + explicit XioDispatcher(Messenger *msgr); virtual ~XioDispatcher(); uint64_t get_dcount() { return dcount; } diff --git a/src/test/mon/test-mon-msg.cc b/src/test/mon/test-mon-msg.cc index a20741a99c22..3e4e0505ded1 100644 --- a/src/test/mon/test-mon-msg.cc +++ b/src/test/mon/test-mon-msg.cc @@ -59,7 +59,7 @@ protected: public: - MonClientHelper(CephContext *cct_) + explicit MonClientHelper(CephContext *cct_) : Dispatcher(cct_), cct(cct_), monc(cct_), diff --git a/src/test/mon/test_mon_workloadgen.cc b/src/test/mon/test_mon_workloadgen.cc index 64575fe5e92b..4ad26c31e1fa 100644 --- a/src/test/mon/test_mon_workloadgen.cc +++ b/src/test/mon/test_mon_workloadgen.cc @@ -90,7 +90,7 @@ class TestStub : public Dispatcher struct C_Tick : public Context { TestStub *s; - C_Tick(TestStub *stub) : s(stub) {} + explicit C_Tick(TestStub *stub) : s(stub) {} void finish(int r) { generic_dout(20) << "C_Tick::" << __func__ << dendl; if (r == -ECANCELED) { @@ -230,7 +230,7 @@ class ClientStub : public TestStub } public: - ClientStub(CephContext *cct) + explicit ClientStub(CephContext *cct) : TestStub(cct, "client"), gen((int) time(NULL)) { } @@ -328,7 +328,7 @@ class OSDStub : public TestStub struct C_CreatePGs : public Context { OSDStub *s; - C_CreatePGs(OSDStub *stub) : s(stub) {} + explicit C_CreatePGs(OSDStub *stub) : s(stub) {} void finish(int r) { if (r == -ECANCELED) { generic_dout(20) << "C_CreatePGs::" << __func__ diff --git a/src/test/msgr/test_async_driver.cc b/src/test/msgr/test_async_driver.cc index fb4637426447..873adeda2dc0 100644 --- a/src/test/msgr/test_async_driver.cc +++ b/src/test/msgr/test_async_driver.cc @@ -272,7 +272,7 @@ class Worker : public Thread { public: EventCenter center; - Worker(CephContext *c): cct(c), done(false), center(c) { + explicit Worker(CephContext *c): cct(c), done(false), center(c) { center.init(100); } void stop() { diff --git a/src/test/msgr/test_msgr.cc b/src/test/msgr/test_msgr.cc index 8829c1e54a64..b19534960986 100644 --- a/src/test/msgr/test_msgr.cc +++ b/src/test/msgr/test_msgr.cc @@ -76,7 +76,7 @@ class FakeDispatcher : public Dispatcher { uint64_t count; ConnectionRef con; - Session(ConnectionRef c): RefCountedObject(g_ceph_context), lock("FakeDispatcher::Session::lock"), count(0), con(c) { + explicit Session(ConnectionRef c): RefCountedObject(g_ceph_context), lock("FakeDispatcher::Session::lock"), count(0), con(c) { } uint64_t get_count() { return count; } }; @@ -89,7 +89,7 @@ class FakeDispatcher : public Dispatcher { bool got_connect; bool loopback; - FakeDispatcher(bool s): Dispatcher(g_ceph_context), lock("FakeDispatcher::lock"), + 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; } @@ -1238,7 +1238,7 @@ class MarkdownDispatcher : public Dispatcher { bool last_mark; public: atomic_t count; - MarkdownDispatcher(bool s): Dispatcher(g_ceph_context), lock("MarkdownDispatcher::lock"), + 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 { diff --git a/src/test/objectstore/TestObjectStoreState.h b/src/test/objectstore/TestObjectStoreState.h index 66a604731ea3..80164c3bf7c1 100644 --- a/src/test/objectstore/TestObjectStoreState.h +++ b/src/test/objectstore/TestObjectStoreState.h @@ -98,7 +98,7 @@ public: int m_next_pool; public: - TestObjectStoreState(ObjectStore *store) : + explicit TestObjectStoreState(ObjectStore *store) : m_next_coll_nr(0), m_num_objs_per_coll(10), m_num_objects(0), m_max_in_flight(0), m_finished_lock("Finished Lock"), m_next_pool(1) { m_in_flight.set(0); @@ -133,7 +133,7 @@ public: TestObjectStoreState *m_state; public: - C_OnFinished(TestObjectStoreState *state) : m_state(state) { } + explicit C_OnFinished(TestObjectStoreState *state) : m_state(state) { } void finish(int r) { Mutex::Locker locker(m_state->m_finished_lock); diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 4f7daf13a860..e13a1dc7e9ed 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -1617,7 +1617,7 @@ class MixedGenerator : public ObjectGenerator { public: unsigned seq; int64_t poolid; - MixedGenerator(int64_t p) : seq(0), poolid(p) {} + explicit MixedGenerator(int64_t p) : seq(0), poolid(p) {} ghobject_t create_object(gen_type *gen) { char buf[100]; snprintf(buf, sizeof(buf), "OBJ_%u", seq); @@ -1672,7 +1672,7 @@ public: struct EnterExit { const char *msg; - EnterExit(const char *m) : msg(m) { + explicit EnterExit(const char *m) : msg(m) { //cout << pthread_self() << " enter " << msg << std::endl; } ~EnterExit() { diff --git a/src/test/objectstore/workload_generator.h b/src/test/objectstore/workload_generator.h index 3b1557499a22..0d5360ee20ef 100644 --- a/src/test/objectstore/workload_generator.h +++ b/src/test/objectstore/workload_generator.h @@ -120,7 +120,7 @@ class WorkloadGenerator : public TestObjectStoreState { void do_stats(); public: - WorkloadGenerator(vector args); + explicit WorkloadGenerator(vector args); ~WorkloadGenerator() { m_store->umount(); } @@ -129,7 +129,7 @@ public: WorkloadGenerator *wrkldgen_state; public: - C_OnReadable(WorkloadGenerator *state) + explicit C_OnReadable(WorkloadGenerator *state) :TestObjectStoreState::C_OnFinished(state), wrkldgen_state(state) { } void finish(int r) diff --git a/src/test/old/testmpi.cc b/src/test/old/testmpi.cc index 9d6700185b0b..68969b5b0888 100644 --- a/src/test/old/testmpi.cc +++ b/src/test/old/testmpi.cc @@ -12,7 +12,7 @@ using namespace std; class Pinger : public Dispatcher { public: Messenger *messenger; - Pinger(Messenger *m) : messenger(m) { + explicit Pinger(Messenger *m) : messenger(m) { m->set_dispatcher(this); } void dispatch(Message *m) { diff --git a/src/test/old/testnewbuffers.cc b/src/test/old/testnewbuffers.cc index 0fea7571a457..69e037c7df20 100644 --- a/src/test/old/testnewbuffers.cc +++ b/src/test/old/testnewbuffers.cc @@ -13,7 +13,7 @@ using namespace std; class Th : public Thread { public: bufferlist bl; - Th(bufferlist& o) : bl(o) { } + explicit Th(bufferlist& o) : bl(o) { } void *entry() { //cout << "start" << endl; diff --git a/src/test/osd/Object.h b/src/test/osd/Object.h index 561685a44b03..ad8800471a26 100644 --- a/src/test/osd/Object.h +++ b/src/test/osd/Object.h @@ -127,7 +127,7 @@ public: class RandWrap { public: unsigned int state; - RandWrap(unsigned int seed) + explicit RandWrap(unsigned int seed) { state = seed; } @@ -305,7 +305,7 @@ public: std::list, ContDesc> >::iterator cur_cont; - iterator(ObjectDesc &obj) : + explicit iterator(ObjectDesc &obj) : pos(0), obj(obj) { limit = obj.layers.begin()->first->get_length(obj.layers.begin()->second); cur_cont = obj.layers.begin(); diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index f023aeacc3ca..53dfdcea5b4e 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -122,7 +122,7 @@ public: */ struct CallbackInfo { uint64_t id; - CallbackInfo(uint64_t id) : id(id) {} + explicit CallbackInfo(uint64_t id) : id(id) {} virtual ~CallbackInfo() {}; }; diff --git a/src/test/osd/TestPGLog.cc b/src/test/osd/TestPGLog.cc index a7f074e4075e..f3c61211bb22 100644 --- a/src/test/osd/TestPGLog.cc +++ b/src/test/osd/TestPGLog.cc @@ -265,7 +265,7 @@ public: struct TestHandler : public PGLog::LogEntryHandler { list &removed; - TestHandler(list &removed) : removed(removed) {} + explicit TestHandler(list &removed) : removed(removed) {} void rollback( const pg_log_entry_t &entry) {} diff --git a/src/test/osd/hitset.cc b/src/test/osd/hitset.cc index 7fab186944a7..414064058dbc 100644 --- a/src/test/osd/hitset.cc +++ b/src/test/osd/hitset.cc @@ -18,7 +18,7 @@ class HitSetTestStrap { public: HitSet *hitset; - HitSetTestStrap(HitSet *h) : hitset(h) {} + explicit HitSetTestStrap(HitSet *h) : hitset(h) {} void fill(unsigned count) { char buf[50]; diff --git a/src/test/osd/types.cc b/src/test/osd/types.cc index 276083db560c..ca1e56a0c3fd 100644 --- a/src/test/osd/types.cc +++ b/src/test/osd/types.cc @@ -1074,7 +1074,7 @@ protected: public: ObjectContext &obc; - Thread_read_lock(ObjectContext& _obc) : + explicit Thread_read_lock(ObjectContext& _obc) : obc(_obc) { } @@ -1089,7 +1089,7 @@ protected: public: ObjectContext &obc; - Thread_write_lock(ObjectContext& _obc) : + explicit Thread_write_lock(ObjectContext& _obc) : obc(_obc) { } diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc index fe642588f4c6..5ec36215464b 100644 --- a/src/test/perf_local.cc +++ b/src/test/perf_local.cc @@ -329,7 +329,7 @@ class CondPingPong { class Consumer : public Thread { CondPingPong *p; public: - Consumer(CondPingPong *p): p(p) {} + explicit Consumer(CondPingPong *p): p(p) {} void* entry() { p->consume(); return 0; @@ -466,7 +466,7 @@ class CenterWorker : public Thread { public: EventCenter center; - CenterWorker(CephContext *c): cct(c), done(false), center(c) { + explicit CenterWorker(CephContext *c): cct(c), done(false), center(c) { center.init(100); } void stop() { @@ -486,7 +486,7 @@ class CountEvent: public EventCallback { atomic_t *count; public: - CountEvent(atomic_t *atomic): count(atomic) {} + explicit CountEvent(atomic_t *atomic): count(atomic) {} void do_request(int id) { count->dec(); } diff --git a/src/test/system/cross_process_sem.h b/src/test/system/cross_process_sem.h index d087d2929918..0cbedf475b90 100644 --- a/src/test/system/cross_process_sem.h +++ b/src/test/system/cross_process_sem.h @@ -35,6 +35,6 @@ public: int reinit(int dval); private: - CrossProcessSem(struct cross_process_sem_data_t *data); + explicit CrossProcessSem(struct cross_process_sem_data_t *data); struct cross_process_sem_data_t *m_data; }; diff --git a/src/test/test_snap_mapper.cc b/src/test/test_snap_mapper.cc index 17cb898c7608..93c87abe41c8 100644 --- a/src/test/test_snap_mapper.cc +++ b/src/test/test_snap_mapper.cc @@ -45,7 +45,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver { typedef ceph::shared_ptr<_Op> Op; struct Remove : public _Op { set to_remove; - Remove(const set &to_remove) : to_remove(to_remove) {} + explicit Remove(const set &to_remove) : to_remove(to_remove) {} void operate(map *store) { for (set::iterator i = to_remove.begin(); i != to_remove.end(); @@ -56,7 +56,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver { }; struct Insert : public _Op { map to_insert; - Insert(const map &to_insert) : to_insert(to_insert) {} + explicit Insert(const map &to_insert) : to_insert(to_insert) {} void operate(map *store) { for (map::iterator i = to_insert.begin(); i != to_insert.end(); @@ -68,7 +68,7 @@ class PausyAsyncMap : public MapCacher::StoreDriver { }; struct Callback : public _Op { Context *context; - Callback(Context *c) : context(c) {} + explicit Callback(Context *c) : context(c) {} void operate(map *store) { context->complete(0); } @@ -103,7 +103,7 @@ private: bool paused; list queue; public: - Doer(PausyAsyncMap *parent) : + explicit Doer(PausyAsyncMap *parent) : parent(parent), lock("Doer lock"), stopping(0), paused(false) {} virtual void *entry() { while (1) { diff --git a/src/test/test_stress_watch.cc b/src/test/test_stress_watch.cc index cafdc20e6e8e..1dd3738c0f0b 100644 --- a/src/test/test_stress_watch.cc +++ b/src/test/test_stress_watch.cc @@ -40,7 +40,7 @@ public: struct WatcherUnwatcher : public Thread { string pool; - WatcherUnwatcher(string& _pool) : pool(_pool) {} + explicit WatcherUnwatcher(string& _pool) : pool(_pool) {} void *entry() { Rados cluster; diff --git a/src/test/test_xlist.cc b/src/test/test_xlist.cc index 9d5eadd0e975..c34f8c540420 100644 --- a/src/test/test_xlist.cc +++ b/src/test/test_xlist.cc @@ -10,7 +10,7 @@ struct Item { xlist::item xitem; int val; - Item(int v) : + explicit Item(int v) : xitem(this), val(v) {} diff --git a/src/tools/RadosDump.h b/src/tools/RadosDump.h index 92c0eeb85b45..54cec998a0ac 100644 --- a/src/tools/RadosDump.h +++ b/src/tools/RadosDump.h @@ -161,7 +161,7 @@ struct object_begin { // of object processing. object_info_t oi; - object_begin(const ghobject_t &hoid): hoid(hoid) { } + explicit object_begin(const ghobject_t &hoid): hoid(hoid) { } object_begin() { } // If superblock doesn't include CEPH_FS_FEATURE_INCOMPAT_SHARDS then @@ -218,8 +218,8 @@ struct data_section { struct attr_section { map data; - attr_section(const map &data) : data(data) { } - attr_section(map &data_) + explicit attr_section(const map &data) : data(data) { } + explicit attr_section(map &data_) { for (std::map::iterator i = data_.begin(); i != data_.end(); ++i) { @@ -245,7 +245,7 @@ struct attr_section { struct omap_hdr_section { bufferlist hdr; - omap_hdr_section(bufferlist hdr) : hdr(hdr) { } + explicit omap_hdr_section(bufferlist hdr) : hdr(hdr) { } omap_hdr_section() { } void encode(bufferlist& bl) const { @@ -262,7 +262,7 @@ struct omap_hdr_section { struct omap_section { map omap; - omap_section(const map &omap) : + explicit omap_section(const map &omap) : omap(omap) { } omap_section() { } diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index c37c3af52935..f9b4696c527d 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -37,7 +37,7 @@ class TraceIter { unsigned idx; MonitorDBStore::TransactionRef t; public: - TraceIter(string fname) : fd(-1), idx(-1) { + explicit TraceIter(string fname) : fd(-1), idx(-1) { fd = ::open(fname.c_str(), O_RDONLY); t.reset(new MonitorDBStore::Transaction); } diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 236dc0efb322..9a44cfc1d99f 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -1795,7 +1795,7 @@ int do_set_omaphdr(ObjectStore *store, coll_t coll, struct do_fix_lost : public action_on_object_t { ObjectStore::Sequencer *osr; - do_fix_lost(ObjectStore::Sequencer *_osr) : osr(_osr) {} + explicit do_fix_lost(ObjectStore::Sequencer *_osr) : osr(_osr) {} virtual int call(ObjectStore *store, coll_t coll, ghobject_t &ghobj, object_info_t &oi) { diff --git a/src/tools/cephfs/TableTool.cc b/src/tools/cephfs/TableTool.cc index ebfcd0a0d583..2d14a4f9286f 100644 --- a/src/tools/cephfs/TableTool.cc +++ b/src/tools/cephfs/TableTool.cc @@ -277,7 +277,7 @@ public: class InoTableHandler : public TableHandler { public: - InoTableHandler(mds_rank_t r) + explicit InoTableHandler(mds_rank_t r) : TableHandler(r, "inotable", true) {} diff --git a/src/tools/rados/PoolDump.h b/src/tools/rados/PoolDump.h index 6b4eae50d9b5..0415050f9780 100644 --- a/src/tools/rados/PoolDump.h +++ b/src/tools/rados/PoolDump.h @@ -25,7 +25,7 @@ namespace librados { class PoolDump : public RadosDump { public: - PoolDump(int file_fd_) : RadosDump(file_fd_, false) {} + explicit PoolDump(int file_fd_) : RadosDump(file_fd_, false) {} int dump(librados::IoCtx *io_ctx); }; diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index 85aeb0187abe..8df20f344e8c 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -542,7 +542,7 @@ public: librados::AioCompletion *completion; LoadGenOp() : id(0), type(0), off(0), len(0), lg(NULL), completion(NULL) {} - LoadGenOp(LoadGen *_lg) : id(0), type(0), off(0), len(0), lg(_lg), completion(NULL) {} + explicit LoadGenOp(LoadGen *_lg) : id(0), type(0), off(0), len(0), lg(_lg), completion(NULL) {} }; int max_op; @@ -577,7 +577,7 @@ public: Mutex lock; Cond cond; - LoadGen(Rados *_rados) : rados(_rados), going_down(false), lock("LoadGen") { + explicit LoadGen(Rados *_rados) : rados(_rados), going_down(false), lock("LoadGen") { read_percent = 80; min_obj_len = 1024; max_obj_len = 5ull * 1024ull * 1024ull * 1024ull; diff --git a/src/tools/rbd/action/BenchWrite.cc b/src/tools/rbd/action/BenchWrite.cc index d767c087991c..849340b50457 100644 --- a/src/tools/rbd/action/BenchWrite.cc +++ b/src/tools/rbd/action/BenchWrite.cc @@ -64,7 +64,7 @@ struct rbd_bencher { Cond cond; int in_flight; - rbd_bencher(librbd::Image *i) + explicit rbd_bencher(librbd::Image *i) : image(i), lock("rbd_bencher::lock"), in_flight(0) diff --git a/src/tools/rbd/action/Journal.cc b/src/tools/rbd/action/Journal.cc index 39666cba6c53..14d1453a50fe 100644 --- a/src/tools/rbd/action/Journal.cc +++ b/src/tools/rbd/action/Journal.cc @@ -262,7 +262,7 @@ public: protected: struct ReplayHandler : public ::journal::ReplayHandler { JournalPlayer *journal; - ReplayHandler(JournalPlayer *_journal) : journal(_journal) {} + explicit ReplayHandler(JournalPlayer *_journal) : journal(_journal) {} virtual void get() {} virtual void put() {}