Set 218 constructors as explicit to avoid implicit usage.
Fix for cppcheck warning:
Class has a constructor with 1 argument that is
not explicit. Such constructors should in general be explicit for
type safety reasons. Using the explicit keyword in the constructor
means some mistakes when using the class can be avoided.
For more information check:
https://www.codeproject.com/Articles/28663/Explicit-Constructor-in-C
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
public:
mds_gid_t mds_gid;
- MDSCommandOp(ceph_tid_t t) : CommandOp(t) {}
+ explicit MDSCommandOp(ceph_tid_t t) : CommandOp(t) {}
};
/* error code for ceph_fuse */
int64_t offset;
string name;
InodeRef inode;
- dentry(int64_t o) : offset(o) {}
+ explicit dentry(int64_t o) : offset(o) {}
dentry(int64_t o, const string& n, const InodeRef& in) :
offset(o), name(n), inode(in) {}
};
int rval; ///< return value
public:
C_SaferCond() : lock("C_SaferCond"), done(false), rval(0) {}
- C_SaferCond(const std::string &name) : lock(name), done(false), rval(0) {}
+ explicit C_SaferCond(const std::string &name) : lock(name), done(false), rval(0) {}
void finish(int r) override { complete(r); }
/// We overload complete in order to not delete the context
bool append{false};
field_entity() {}
- field_entity(const string& n) : is_obj(true), name(n) {}
- field_entity(int i) : is_obj(false), index(i) {}
+ explicit field_entity(const string& n) : is_obj(true), name(n) {}
+ explicit field_entity(int i) : is_obj(false), index(i) {}
};
static int parse_entity(const string& s, vector<field_entity> *result)
} opt_type_t;
// Create a new md_config_t structure.
- md_config_t(bool is_daemon=false);
+ explicit md_config_t(bool is_daemon=false);
~md_config_t();
// Adds a new observer to this configuration. You can do this at any time,
const char old_fill;
const std::ostream::fmtflags old_flags;
- hex_formatter(std::ostream& out)
+ explicit hex_formatter(std::ostream& out)
: out(out),
old_fill(out.fill('0')),
old_flags(out.setf(out.hex, out.basefield))
// wrappers around scrub types to offer the necessary bits other than
// the minimal set that the lirados requires
struct object_id_wrapper : public librados::object_id_t {
- object_id_wrapper(const hobject_t& hoid)
+ explicit object_id_wrapper(const hobject_t& hoid)
: object_id_t{hoid.oid.name, hoid.nspace, hoid.get_key(), hoid.snap}
{}
void encode(bufferlist& bl) const;
struct shard_info_wrapper : public librados::shard_info_t {
public:
shard_info_wrapper() = default;
- shard_info_wrapper(const ScrubMap::object& object) {
+ explicit shard_info_wrapper(const ScrubMap::object& object) {
set_object(object);
}
void set_object(const ScrubMap::object& object);
}
struct inconsistent_obj_wrapper : librados::inconsistent_obj_t {
- inconsistent_obj_wrapper(const hobject_t& hoid);
+ explicit inconsistent_obj_wrapper(const hobject_t& hoid);
void set_object_info_inconsistency() {
errors |= obj_err_t::OBJECT_INFO_INCONSISTENCY;
struct inconsistent_snapset_wrapper : public librados::inconsistent_snapset_t {
inconsistent_snapset_wrapper() = default;
- inconsistent_snapset_wrapper(const hobject_t& head);
+ explicit inconsistent_snapset_wrapper(const hobject_t& head);
void set_headless();
// soid claims that it is a head or a snapdir, but its SS_ATTR
// is missing.
int _parse(const std::string& s);
public:
- CrushLocation(CephContext *c) : cct(c) {
+ explicit CrushLocation(CephContext *c) : cct(c) {
init_on_startup();
}
void clear() {
ops.clear();
}
- MDBTransactionImpl(MemDB* _db) :m_db(_db)
+ explicit MDBTransactionImpl(MemDB* _db) :m_db(_db)
{
ops.clear();
}
return store.assoc_name.c_str();
}
- MergeOperatorRouter(RocksDBStore &_store) : store(_store) {}
+ explicit MergeOperatorRouter(RocksDBStore &_store) : store(_store) {}
bool Merge(const rocksdb::Slice& key,
const rocksdb::Slice* existing_value,
private:
std::shared_ptr<KeyValueDB::MergeOperator> mop;
public:
- MergeOperatorLinker(const std::shared_ptr<KeyValueDB::MergeOperator> &o) : mop(o) {}
+ explicit MergeOperatorLinker(const std::shared_ptr<KeyValueDB::MergeOperator> &o) : mop(o) {}
const char *Name() const override {
return mop->name().c_str();
class ImageUpdateWatchers {
public:
- ImageUpdateWatchers(CephContext *cct) : m_cct(cct),
+ explicit ImageUpdateWatchers(CephContext *cct) : m_cct(cct),
m_lock(util::unique_lock_name("librbd::ImageUpdateWatchers::m_lock", this)) {
}
uint64_t tag_tid = 0;
journal::TagData tag_data;
- C_RefreshTags(util::AsyncOpTracker &async_op_tracker)
+ explicit C_RefreshTags(util::AsyncOpTracker &async_op_tracker)
: async_op_tracker(async_op_tracker),
lock("librbd::Journal::C_RefreshTags::lock") {
async_op_tracker.start_op();
public:
typedef std::vector<std::pair<uint64_t,uint64_t> > Extents;
- ImageWriteback(ImageCtxT &image_ctx);
+ explicit ImageWriteback(ImageCtxT &image_ctx);
void aio_read(Extents &&image_extents, ceph::bufferlist *bl,
int fadvise_flags, Context *on_finish);
template <typename ImageCtxT = librbd::ImageCtx>
class PassthroughImageCache : public ImageCache {
public:
- PassthroughImageCache(ImageCtx &image_ctx);
+ explicit PassthroughImageCache(ImageCtx &image_ctx);
/// client AIO methods
void aio_read(Extents&& image_extents, ceph::bufferlist *bl,
struct ReadResult::SetClipLengthVisitor : public boost::static_visitor<void> {
size_t length;
- SetClipLengthVisitor(size_t length) : length(length) {
+ explicit SetClipLengthVisitor(size_t length) : length(length) {
}
void operator()(Linear &linear) const {
sr_t *snapnode = UNDEF_SRNODE;
projected_inode() = delete;
- projected_inode(const mempool_inode &in) : inode(in) {}
+ explicit projected_inode(const mempool_inode &in) : inode(in) {}
};
private:
const inodeno_t ino) const;
- DamageTable(const mds_rank_t rank_)
+ explicit DamageTable(const mds_rank_t rank_)
: rank(rank_)
{
assert(rank_ != MDS_RANK_NONE);
class OpenFileTable
{
public:
- OpenFileTable(MDSRank *m) : mds(m) {}
+ explicit OpenFileTable(MDSRank *m) : mds(m) {}
void add_inode(CInode *in);
void remove_inode(CInode *in);
bufferlist odata;
cmdmap_t cmdmap;
- CommandContext(MCommand *m_)
+ explicit CommandContext(MCommand *m_)
: m(m_)
{
}
bufferlist from_mon;
string outs;
- ReplyOnFinish(const std::shared_ptr<CommandContext> &cmdctx_)
+ explicit ReplyOnFinish(const std::shared_ptr<CommandContext> &cmdctx_)
: cmdctx(cmdctx_)
{}
void finish(int r) override {
// The record of perf stat types, shared between daemons
PerfCounterTypes &types;
- DaemonPerfCounters(PerfCounterTypes &types_)
+ explicit DaemonPerfCounters(PerfCounterTypes &types_)
: types(types_)
{}
// The perf counters received in MMgrReport messages
DaemonPerfCounters perf_counters;
- DaemonState(PerfCounterTypes &types_)
+ explicit DaemonState(PerfCounterTypes &types_)
: perf_counters(types_)
{
}
class SafeThreadState
{
public:
- SafeThreadState(PyThreadState *ts_);
+ explicit SafeThreadState(PyThreadState *ts_);
SafeThreadState()
: ts(nullptr), thread(0)
{
public:
- MgrCommand(ceph_tid_t t) : CommandOp(t) {}
+ explicit MgrCommand(ceph_tid_t t) : CommandOp(t) {}
MgrCommand() : CommandOp() {}
};
std::set<std::string> declared_types;
- MgrSession(CephContext *cct) : RefCountedObject(cct, 0) {}
+ explicit MgrSession(CephContext *cct) : RefCountedObject(cct, 0) {}
~MgrSession() override {}
};
PyObject *pClass = nullptr;
PyObject *pStandbyClass = nullptr;
- PyModule(const std::string &module_name_)
+ explicit PyModule(const std::string &module_name_)
: module_name(module_name_)
{
}
return modules_out;
}
- PyModuleRegistry(LogChannelRef clog_)
+ explicit PyModuleRegistry(LogChannelRef clog_)
: clog(clog_)
{}
PyModuleRunner *mod;
public:
- PyModuleRunnerThread(PyModuleRunner *mod_)
+ explicit PyModuleRunnerThread(PyModuleRunner *mod_)
: mod(mod_) {}
void *entry() override;
class FsNewHandler : public FileSystemCommandHandler
{
public:
- FsNewHandler(Paxos *paxos)
+ explicit FsNewHandler(Paxos *paxos)
: FileSystemCommandHandler("fs new"), m_paxos(paxos)
{
}
class AddDataPoolHandler : public FileSystemCommandHandler
{
public:
- AddDataPoolHandler(Paxos *paxos)
+ explicit AddDataPoolHandler(Paxos *paxos)
: FileSystemCommandHandler("fs add_data_pool"), m_paxos(paxos)
{}
std::string alias_prefix;
public:
- AliasHandler(const std::string &new_prefix)
+ explicit AliasHandler(const std::string &new_prefix)
: T()
{
alias_prefix = new_prefix;
CephContext *cct;
std::shared_ptr<NetworkStack> stack;
- StackSingleton(CephContext *c): cct(c) {}
+ explicit StackSingleton(CephContext *c): cct(c) {}
void ready(std::string &type) {
if (!stack)
stack = NetworkStack::create(cct, type);
public:
UserspaceEventManager manager;
- DPDKDriver(CephContext *c): cct(c), manager(c) {}
+ explicit DPDKDriver(CephContext *c): cct(c), manager(c) {}
virtual ~DPDKDriver() { }
int init(EventCenter *c, int nevent) override;
fragment frags[];
- impl(size_t nr_frags = default_nr_frags);
+ explicit impl(size_t nr_frags = default_nr_frags);
impl(const impl&) = delete;
impl(fragment frag, size_t nr_frags = default_nr_frags);
to->frags[0].base);
}
};
- Packet(std::unique_ptr<impl>&& impl) : _impl(std::move(impl)) {}
+ explicit Packet(std::unique_ptr<impl>&& impl) : _impl(std::move(impl)) {}
std::unique_ptr<impl> _impl;
public:
static Packet from_static_data(const char* data, size_t len) {
// build empty Packet
Packet();
// build empty Packet with nr_frags allocated
- Packet(size_t nr_frags);
+ explicit Packet(size_t nr_frags);
// move existing Packet
Packet(Packet&& x) noexcept;
// copy data into Packet
Packet(const char* data, size_t len);
// copy data into Packet
- Packet(fragment frag);
+ explicit Packet(fragment frag);
// zero-copy single fragment
Packet(fragment frag, deleter del);
// zero-copy multiple fragments
std::list<uint32_t> unused_fds;
public:
- UserspaceEventManager(CephContext *c): cct(c) {
+ explicit UserspaceEventManager(CephContext *c): cct(c) {
waiting_fds.resize(1024);
}
struct ethernet_address {
ethernet_address() {}
- ethernet_address(const uint8_t *eaddr) {
+ explicit ethernet_address(const uint8_t *eaddr) {
std::copy(eaddr, eaddr + 6, mac.begin());
}
- ethernet_address(std::initializer_list<uint8_t> eaddr) {
+ explicit ethernet_address(std::initializer_list<uint8_t> eaddr) {
assert(eaddr.size() == mac.size());
std::copy(eaddr.begin(), eaddr.end(), mac.begin());
}
stream<Packet, ethernet_address> packet_stream;
std::function<bool (forward_hash&, Packet&, size_t)> forward;
bool ready() { return packet_stream.started(); }
- l3_rx_stream(std::function<bool (forward_hash&, Packet&, size_t)>&& fw) : forward(fw) {}
+ explicit l3_rx_stream(std::function<bool (forward_hash&, Packet&, size_t)>&& fw) : forward(fw) {}
};
std::unordered_map<uint16_t, l3_rx_stream> _proto_map;
std::shared_ptr<DPDKDevice> _dev;
int num;
Device** devices;
public:
- DeviceList(CephContext *cct): device_list(ibv_get_device_list(&num)) {
+ explicit DeviceList(CephContext *cct): device_list(ibv_get_device_list(&num)) {
if (device_list == NULL || num == 0) {
lderr(cct) << __func__ << " failed to get rdma device list. " << cpp_strerror(errno) << dendl;
ceph_abort();
unsigned n_bufs_allocated;
// true if it is possible to alloc
// more memory for the pool
- MemPoolContext(MemoryManager *m) :
+ explicit MemPoolContext(MemoryManager *m) :
perf_logger(nullptr),
manager(m),
n_bufs_allocated(0) {}
class C_handle_cq_async : public EventCallback {
RDMADispatcher *dispatcher;
public:
- C_handle_cq_async(RDMADispatcher *w): dispatcher(w) {}
+ explicit C_handle_cq_async(RDMADispatcher *w): dispatcher(w) {}
void do_request(uint64_t fd) {
// worker->handle_tx_event();
dispatcher->handle_async_event();
class C_handle_cq_tx : public EventCallback {
RDMAWorker *worker;
public:
- C_handle_cq_tx(RDMAWorker *w): worker(w) {}
+ explicit C_handle_cq_tx(RDMAWorker *w): worker(w) {}
void do_request(uint64_t fd) {
worker->handle_pending_message();
}
RDMAConnectedSocketImpl *csi;
bool active;
public:
- C_handle_connection(RDMAConnectedSocketImpl *w): csi(w), active(true) {}
+ explicit C_handle_connection(RDMAConnectedSocketImpl *w): csi(w), active(true) {}
void do_request(uint64_t fd) {
if (active)
csi->handle_connection();
void package_init(CephContext *cct);
protected:
- XioInit(CephContext *cct) {
+ explicit XioInit(CephContext *cct) {
this->package_init(cct);
}
};
struct object_extent_set : boost::intrusive::set_base_hook<> {
hobject_t oid;
- object_extent_set(const hobject_t &oid) : oid(oid) {}
+ explicit object_extent_set(const hobject_t &oid) : oid(oid) {}
using set_member_options = boost::intrusive::member_hook<
extent,
bool operator()(const set<pg_shard_t> &have) const {
return have.size() >= pi->min_size;
}
- min_size_predicate_t(const pg_pool_t *i) : pi(i) {}
+ explicit min_size_predicate_t(const pg_pool_t *i) : pi(i) {}
} min_size_predicate(osdmap->get_pg_pool(pgid.pgid.pool()));
bool new_interval = PastIntervals::check_new_interval(
std::string object_prefix;
OSDCapMatch() {}
- OSDCapMatch(const OSDCapPoolTag& pt) : pool_tag(pt) {}
- OSDCapMatch(const OSDCapPoolNamespace& pns) : pool_namespace(pns) {}
+ explicit OSDCapMatch(const OSDCapPoolTag& pt) : pool_tag(pt) {}
+ explicit OSDCapMatch(const OSDCapPoolNamespace& pns) : pool_namespace(pns) {}
OSDCapMatch(const OSDCapPoolNamespace& pns, const std::string& pre)
: pool_namespace(pns), object_prefix(pre) {}
OSDCapMatch(const std::string& pl, const std::string& pre)
OSDCapGrant() {}
OSDCapGrant(const OSDCapMatch& m, const OSDCapSpec& s) : match(m), spec(s) {}
- OSDCapGrant(const OSDCapProfile& profile) : profile(profile) {
+ explicit OSDCapGrant(const OSDCapProfile& profile) : profile(profile) {
expand_profile();
}
return pgid;
}
public:
- PGOpQueueable(spg_t pg) : pgid(pg) {}
+ explicit PGOpQueueable(spg_t pg) : pgid(pg) {}
uint32_t get_queue_token() const override final {
return get_pgid().ps();
}
class Locker : public OpQueueItem::OrderLocker {
PGRef pg;
public:
- Locker(PGRef pg) : pg(pg) {}
+ explicit Locker(PGRef pg) : pg(pg) {}
void lock() override final {
pg->lock();
}
return;
struct OnComplete : Context {
std::unique_ptr<Scrub::Store> store;
- OnComplete(
+ explicit OnComplete(
std::unique_ptr<Scrub::Store> &&store)
: store(std::move(store)) {}
void finish(int) override {}
{ }
template <typename... Args>
- IndexedLog(Args&&... args) :
+ explicit IndexedLog(Args&&... args) :
pg_log_t(std::forward<Args>(args)...),
complete_to(log.end()),
last_requested(0),
struct CopyFromFinisher : public PrimaryLogPG::OpFinisher {
CopyFromCallback *copy_from_callback;
- CopyFromFinisher(CopyFromCallback *copy_from_callback)
+ explicit CopyFromFinisher(CopyFromCallback *copy_from_callback)
: copy_from_callback(copy_from_callback) {
}
inodeno_t parent_ino;
public:
CephContext* cct;
- PGLSParentFilter(CephContext* cct) : cct(cct) {
+ explicit PGLSParentFilter(CephContext* cct) : cct(cct) {
xattr = "_parent";
}
int init(bufferlist::iterator ¶ms) override
struct SetManifestFinisher : public PrimaryLogPG::OpFinisher {
OSDOp& osd_op;
- SetManifestFinisher(OSDOp& osd_op) : osd_op(osd_op) {
+ explicit SetManifestFinisher(OSDOp& osd_op) : osd_op(osd_op) {
}
int execute() override {
struct PromoteFinisher : public PrimaryLogPG::OpFinisher {
PromoteManifestCallback *promote_callback;
- PromoteFinisher(PromoteManifestCallback *promote_callback)
+ explicit PromoteFinisher(PromoteManifestCallback *promote_callback)
: promote_callback(promote_callback) {
}
struct ReadFinisher : public PrimaryLogPG::OpFinisher {
OSDOp& osd_op;
- ReadFinisher(OSDOp& osd_op) : osd_op(osd_op) {
+ explicit ReadFinisher(OSDOp& osd_op) : osd_op(osd_op) {
}
int execute() override {
struct ReservationCB : public Context {
PrimaryLogPGRef pg;
bool canceled;
- ReservationCB(PrimaryLogPG *pg) : pg(pg), canceled(false) {}
+ explicit ReservationCB(PrimaryLogPG *pg) : pg(pg), canceled(false) {}
void finish(int) override {
pg->lock();
if (!canceled)
std::set<WatchRef> watches;
public:
CephContext* cct;
- WatchConState(CephContext* cct) : lock("WatchConState"), cct(cct) {}
+ explicit WatchConState(CephContext* cct) : lock("WatchConState"), cct(cct) {}
/// Add a watch
void addWatch(
unique_ptr<interval_rep> past_intervals;
- PastIntervals(interval_rep *rep) : past_intervals(rep) {}
+ explicit PastIntervals(interval_rep *rep) : past_intervals(rep) {}
public:
void add_interval(bool ec_pool, const pg_interval_t &interval) {
class Journaler::C_DelayFlush : public Context {
Journaler *journaler;
public:
- C_DelayFlush(Journaler *j) : journaler(j) {}
+ explicit C_DelayFlush(Journaler *j) : journaler(j) {}
void finish(int r) override {
journaler->_do_delayed_flush();
}
// object cmpext
struct C_ObjectOperation_cmpext : public Context {
int *prval;
- C_ObjectOperation_cmpext(int *prval)
+ explicit C_ObjectOperation_cmpext(int *prval)
: prval(prval) {}
void finish(int r) {
base_oloc(oloc)
{}
- op_target_t(pg_t pgid)
+ explicit op_target_t(pg_t pgid)
: base_oloc(pgid.pool(), pgid.ps()),
precalc_pgid(true),
base_pgid(pgid)
watch_pending_async.pop_front();
}
- LingerOp(Objecter *o) : linger_id(0),
+ explicit LingerOp(Objecter *o) : linger_id(0),
target(object_t(), object_locator_t(), 0),
snap(CEPH_NOSNAP), poutbl(NULL), pobjver(NULL),
is_watch(false), last_error(0),
class RGWAccessControlPolicy_SWIFTAcct : public RGWAccessControlPolicy
{
public:
- RGWAccessControlPolicy_SWIFTAcct(CephContext * const cct)
+ explicit RGWAccessControlPolicy_SWIFTAcct(CephContext * const cct)
: RGWAccessControlPolicy(cct) {
}
~RGWAccessControlPolicy_SWIFTAcct() override {}
tcp::socket socket;
bool use_ssl = false;
- Listener(boost::asio::io_service& service)
+ explicit Listener(boost::asio::io_service& service)
: acceptor(service), socket(service) {}
};
std::vector<Listener> listeners;
std::pair<IdentityApplier::aplptr_t, Completer::cmplptr_t> result_pair;
- AuthResult(const int reason)
+ explicit AuthResult(const int reason)
: reason(reason) {
}
/* Allow only the reasonable combintations - returning just Completer
* without accompanying IdentityApplier is strictly prohibited! */
- AuthResult(IdentityApplier::aplptr_t&& applier)
+ explicit AuthResult(IdentityApplier::aplptr_t&& applier)
: result_pair(std::move(applier), nullptr) {
}
}
public:
- DecoratedApplier(DecorateeT&& decoratee)
+ explicit DecoratedApplier(DecorateeT&& decoratee)
: decoratee(std::forward<DecorateeT>(decoratee)) {
}
/* This will be initialized on the first call to this method. In C++11 it's
* also thread-safe. */
static const struct RolesCacher {
- RolesCacher(CephContext* const cct) {
+ explicit RolesCacher(CephContext* const cct) {
get_str_vec(cct->_conf->rgw_keystone_accepted_roles, plain);
get_str_vec(cct->_conf->rgw_keystone_accepted_admin_roles, admin);
/* This will be initialized on the first call to this method. In C++11 it's
* also thread-safe. */
static const struct RolesCacher {
- RolesCacher(CephContext* const cct) {
+ explicit RolesCacher(CephContext* const cct) {
get_str_vec(cct->_conf->rgw_keystone_accepted_roles, plain);
get_str_vec(cct->_conf->rgw_keystone_accepted_admin_roles, admin);
signature(signature.to_string()) {
}
- ChunkMeta(const boost::string_view& signature)
+ explicit ChunkMeta(const boost::string_view& signature)
: signature(signature.to_string()) {
}
/* Defined in rgw_auth_s3.cc because of get_v4_exp_payload_hash(). We need
* the constructor to be public because of the std::make_shared employed by
* the create() method. */
- AWSv4ComplSingle(const req_state* const s);
+ explicit AWSv4ComplSingle(const req_state* const s);
~AWSv4ComplSingle() {
if (sha256_hash) {
types t;
rgw_user u;
- Principal(types t)
+ explicit Principal(types t)
: t(t) {}
Principal(types t, std::string&& n, std::string i)
return env;
}
- RGWCivetWeb(mg_connection *_conn);
+ explicit RGWCivetWeb(mg_connection *_conn);
};
#endif
}
public:
- DecoratedRestfulClient(DecorateeT&& decoratee)
+ explicit DecoratedRestfulClient(DecorateeT&& decoratee)
: decoratee(std::forward<DecorateeT>(decoratee)) {
}
std::streambuf::char_type buffer[BufferSizeV];
public:
- StaticOutputBufferer(BuffererSink& sink)
+ explicit StaticOutputBufferer(BuffererSink& sink)
: sink(sink) {
constexpr size_t len = sizeof(buffer) - sizeof(std::streambuf::char_type);
std::streambuf::setp(buffer, buffer + len);
public:
template <typename U>
- ChunkingFilter(U&& decoratee)
+ explicit ChunkingFilter(U&& decoratee)
: DecoratedRestfulClient<T>(std::forward<U>(decoratee)),
chunking_enabled(false) {
}
public:
template <typename U>
- ConLenControllingFilter(U&& decoratee)
+ explicit ConLenControllingFilter(U&& decoratee)
: DecoratedRestfulClient<T>(std::forward<U>(decoratee)),
action(ContentLengthAction::UNKNOWN) {
}
public:
template <typename U>
- ReorderingFilter(U&& decoratee)
+ explicit ReorderingFilter(U&& decoratee)
: DecoratedRestfulClient<T>(std::forward<U>(decoratee)),
phase(ReorderState::RGW_EARLY_HEADERS) {
}
void _wakeup(void *opaque);
void _complete(RGWAioCompletionNotifier *cn, const rgw_io_id& io_id, void *user_info);
public:
- RGWCompletionManager(CephContext *_cct);
+ explicit RGWCompletionManager(CephContext *_cct);
~RGWCompletionManager() override;
void complete(RGWAioCompletionNotifier *cn, const rgw_io_id& io_id, void *user_info);
utime_t timestamp;
stringstream status;
- Status(CephContext *_cct) : cct(_cct), lock("RGWCoroutine::Status::lock"), max_history(MAX_COROUTINE_HISTORY) {}
+ explicit Status(CephContext *_cct) : cct(_cct), lock("RGWCoroutine::Status::lock"), max_history(MAX_COROUTINE_HISTORY) {}
deque<StatusItem> history;
list<T> product;
public:
- RGWConsumerCR(CephContext *_cct) : RGWCoroutine(_cct) {}
+ explicit RGWConsumerCR(CephContext *_cct) : RGWCoroutine(_cct) {}
bool has_product() {
return !product.empty();
string admin_command;
public:
- RGWCoroutinesManagerRegistry(CephContext *_cct) : cct(_cct), lock("RGWCoroutinesRegistry::lock") {}
+ explicit RGWCoroutinesManagerRegistry(CephContext *_cct) : cct(_cct), lock("RGWCoroutinesRegistry::lock") {}
~RGWCoroutinesManagerRegistry() override;
void add(RGWCoroutinesManager *mgr);
class WriteDrainNotify : public RGWWriteDrainCB {
RGWStreamWriteHTTPResourceCRF *crf;
public:
- WriteDrainNotify(RGWStreamWriteHTTPResourceCRF *_crf) : crf(_crf) {}
+ explicit WriteDrainNotify(RGWStreamWriteHTTPResourceCRF *_crf) : crf(_crf) {}
void notify(uint64_t pending_size) override;
} write_drain_notify_cb;
CephContext* cct;
uint8_t key[AES_256_KEYSIZE];
public:
- AES_256_CTR(CephContext* cct): cct(cct) {
+ explicit AES_256_CTR(CephContext* cct): cct(cct) {
}
~AES_256_CTR() {
memset(key, 0, AES_256_KEYSIZE);
CephContext* cct;
uint8_t key[AES_256_KEYSIZE];
public:
- AES_256_CBC(CephContext* cct): cct(cct) {
+ explicit AES_256_CBC(CephContext* cct): cct(cct) {
}
~AES_256_CBC() {
memset(key, 0, AES_256_KEYSIZE);
*/
struct log_content {
const boost::string_view buf;
- log_content(const boost::string_view buf)
+ explicit log_content(const boost::string_view buf)
: buf(buf) {}
};
// ostream wrappers to print buckets without copying strings
struct bucket_str {
const rgw_bucket& b;
- bucket_str(const rgw_bucket& b) : b(b) {}
+ explicit bucket_str(const rgw_bucket& b) : b(b) {}
};
std::ostream& operator<<(std::ostream& out, const bucket_str& rhs) {
auto& b = rhs.b;
struct bucket_str_noinstance {
const rgw_bucket& b;
- bucket_str_noinstance(const rgw_bucket& b) : b(b) {}
+ explicit bucket_str_noinstance(const rgw_bucket& b) : b(b) {}
};
std::ostream& operator<<(std::ostream& out, const bucket_str_noinstance& rhs) {
auto& b = rhs.b;
struct bucket_shard_str {
const rgw_bucket_shard& bs;
- bucket_shard_str(const rgw_bucket_shard& bs) : bs(bs) {}
+ explicit bucket_shard_str(const rgw_bucket_shard& bs) : bs(bs) {}
};
std::ostream& operator<<(std::ostream& out, const bucket_shard_str& rhs) {
auto& bs = rhs.bs;
ESQueryNode *first{nullptr};
ESQueryNode *second{nullptr};
public:
- ESQueryNode_Bool(ESQueryCompiler *compiler) : ESQueryNode(compiler) {}
+ explicit ESQueryNode_Bool(ESQueryCompiler *compiler) : ESQueryNode(compiler) {}
ESQueryNode_Bool(ESQueryCompiler *compiler, const string& _op, ESQueryNode *_first, ESQueryNode *_second) :ESQueryNode(compiler), op(_op), first(_first), second(_second) {}
bool init(ESQueryStack *s, ESQueryNode **pnode, string *perr) override {
bool valid = s->pop(&op);
class ESQueryNode_Op_Equal : public ESQueryNode_Op {
public:
- ESQueryNode_Op_Equal(ESQueryCompiler *compiler) : ESQueryNode_Op(compiler) {}
+ explicit ESQueryNode_Op_Equal(ESQueryCompiler *compiler) : ESQueryNode_Op(compiler) {}
ESQueryNode_Op_Equal(ESQueryCompiler *compiler, const string& f, const string& v) : ESQueryNode_Op(compiler) {
op = "==";
field = f;
list<string>::iterator iter;
public:
- ESQueryStack(list<string>& src) {
+ explicit ESQueryStack(list<string>& src) {
assign(src);
}
bool parse_close_bracket();
public:
- ESInfixQueryParser(const string& _query) : query(_query), size(query.size()), str(query.c_str()) {}
+ explicit ESInfixQueryParser(const string& _query) : query(_query), size(query.size()), str(query.c_str()) {}
bool parse(list<string> *result);
};
map<string, EntityType> m;
- ESEntityTypeMap(map<string, EntityType>& _m) : m(_m) {}
+ explicit ESEntityTypeMap(map<string, EntityType>& _m) : m(_m) {}
bool find(const string& entity, EntityType *ptype) {
auto i = m.find(entity);
{
RGWLibFS* fs;
public:
- ObjUnref(RGWLibFS* _fs) : fs(_fs) {}
+ explicit ObjUnref(RGWLibFS* _fs) : fs(_fs) {}
void operator()(RGWFileHandle* fh) const {
lsubdout(fs->get_context(), rgw, 5)
<< __func__
friend class RGWLibFS;
private:
- RGWFileHandle(RGWLibFS* _fs)
+ explicit RGWFileHandle(RGWLibFS* _fs)
: fs(_fs), bucket(nullptr), parent(nullptr), variant_type{directory()},
depth(0), flags(FLAG_NONE)
{
{
RGWFileHandle& rgw_fh;
- WriteCompletion(RGWFileHandle& _fh) : rgw_fh(_fh) {
+ explicit WriteCompletion(RGWFileHandle& _fh) : rgw_fh(_fh) {
rgw_fh.get_fs()->ref(&rgw_fh);
}
std::multimap<std::string, std::string>& config_map);
public:
- RGWFrontendConfig(const std::string& config)
+ explicit RGWFrontendConfig(const std::string& config)
: config(config) {
}
static constexpr bool prioritize_write = true;
RWLock mutex;
- RGWMongooseEnv(const RGWProcessEnv &env)
+ explicit RGWMongooseEnv(const RGWProcessEnv &env)
: RGWProcessEnv(env),
mutex("RGWCivetWebFrontend", false, true, prioritize_write) {
}
mono_time lastuse;
CURL* h;
- RGWCurlHandle(CURL* h) : uses(0), h(h) {};
+ explicit RGWCurlHandle(CURL* h) : uses(0), h(h) {};
CURL* operator*() {
return this->h;
}
RGWHTTPManager *manager;
public:
- ReqsThread(RGWHTTPManager *_m) : manager(_m) {}
+ explicit ReqsThread(RGWHTTPManager *_m) : manager(_m) {}
void *entry() override;
};
{
std::vector <std::mutex> locks;
public:
- RGWSSLSetup(int n) : locks (n){}
+ explicit RGWSSLSetup(int n) : locks (n){}
void set_lock(int id){
try {
struct PolicyParseException : public std::exception {
rapidjson::ParseResult pr;
- PolicyParseException(rapidjson::ParseResult&& pr)
+ explicit PolicyParseException(rapidjson::ParseResult&& pr)
: pr(pr) { }
const char* what() const noexcept override {
return rapidjson::GetParseError_En(pr.Code());
const size_t max;
- TokenCache(const rgw::keystone::Config& config)
+ explicit TokenCache(const rgw::keystone::Config& config)
: revocator(g_ceph_context, this, config),
cct(g_ceph_context),
lock("rgw::keystone::TokenCache"),
const Config& conf;
public:
- AdminTokenRequestVer2(const Config& conf)
+ explicit AdminTokenRequestVer2(const Config& conf)
: conf(conf) {
}
void dump(Formatter *f) const override;
const Config& conf;
public:
- AdminTokenRequestVer3(const Config& conf)
+ explicit AdminTokenRequestVer3(const Config& conf)
: conf(conf) {
}
void dump(Formatter *f) const override;
CephContext *cct;
public:
- BarbicanTokenRequestVer2(CephContext * const _cct)
+ explicit BarbicanTokenRequestVer2(CephContext * const _cct)
: cct(_cct) {
}
void dump(Formatter *f) const;
CephContext *cct;
public:
- BarbicanTokenRequestVer3(CephContext * const _cct)
+ explicit BarbicanTokenRequestVer3(CephContext * const _cct)
: cct(_cct) {
}
void dump(Formatter *f) const;
bool _add_rule(LCRule *rule);
bool has_same_action(const lc_op& first, const lc_op& second);
public:
- RGWLifecycleConfiguration(CephContext *_cct) : cct(_cct) {}
+ explicit RGWLifecycleConfiguration(CephContext *_cct) : cct(_cct) {}
RGWLifecycleConfiguration() : cct(NULL) {}
void set_ctx(CephContext *ctx) {
CephContext *cct;
public:
LCRule_S3(): cct(nullptr) {}
- LCRule_S3(CephContext *_cct): cct(_cct) {}
+ explicit LCRule_S3(CephContext *_cct): cct(_cct) {}
~LCRule_S3() override {}
void to_xml(ostream& out);
XMLObj *alloc_obj(const char *el) override;
public:
- RGWLCXMLParser_S3(CephContext *_cct) : cct(_cct) {}
+ explicit RGWLCXMLParser_S3(CephContext *_cct) : cct(_cct) {}
};
class RGWLifecycleConfiguration_S3 : public RGWLifecycleConfiguration, public XMLObj
{
public:
- RGWLifecycleConfiguration_S3(CephContext *_cct) : RGWLifecycleConfiguration(_cct) {}
+ explicit RGWLifecycleConfiguration_S3(CephContext *_cct) : RGWLifecycleConfiguration(_cct) {}
RGWLifecycleConfiguration_S3() : RGWLifecycleConfiguration(NULL) {}
~RGWLifecycleConfiguration_S3() override {}
RGWLibIO() {
get_env().set("HTTP_HOST", "");
}
- RGWLibIO(const RGWUserInfo &_user_info)
+ explicit RGWLibIO(const RGWUserInfo &_user_info)
: user_info(_user_info) {}
int init_env(CephContext *cct) override {
std::mutex mutex; //< protects callback between cancel/complete
boost::optional<info_callback_t> callback; //< cleared on cancel
public:
- RGWMetadataLogInfoCompletion(info_callback_t callback);
+ explicit RGWMetadataLogInfoCompletion(info_callback_t callback);
~RGWMetadataLogInfoCompletion() override;
librados::IoCtx& get_io_ctx() { return io_ctx; }
{
RGWPutObj *op;
public:
- RGWPutObj_CB(RGWPutObj *_op) : op(_op) {}
+ explicit RGWPutObj_CB(RGWPutObj *_op) : op(_op) {}
~RGWPutObj_CB() override {}
int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override {
RGWGetObj_Filter *next{nullptr};
public:
RGWGetObj_Filter() {}
- RGWGetObj_Filter(RGWGetObj_Filter *next): next(next) {}
+ explicit RGWGetObj_Filter(RGWGetObj_Filter *next): next(next) {}
~RGWGetObj_Filter() override {}
/**
* Passes data through filter.
}
public:
- DecoratedStreamGetter(StreamGetter& decoratee)
+ explicit DecoratedStreamGetter(StreamGetter& decoratee)
: decoratee(decoratee) {
}
virtual ~DecoratedStreamGetter() = default;
protected:
RGWPutObjDataProcessor* next;
public:
- RGWPutObj_Filter(RGWPutObjDataProcessor* next) :
+ explicit RGWPutObj_Filter(RGWPutObjDataProcessor* next) :
next(next){}
~RGWPutObj_Filter() override {}
int handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_raw_obj *pobj, bool *again) override {
class RGWPeriodPuller : public RGWPeriodHistory::Puller {
RGWRados *const store;
public:
- RGWPeriodPuller(RGWRados* store) : store(store) {}
+ explicit RGWPeriodPuller(RGWRados* store) : store(store) {}
int pull(const std::string& period_id, RGWPeriod& period) override;
};
class RGWPeriodPusher final : public RGWRealmWatcher::Watcher,
public RGWRealmReloader::Pauser {
public:
- RGWPeriodPusher(RGWRados* store);
+ explicit RGWPeriodPusher(RGWRados* store);
~RGWPeriodPusher() override;
/// respond to realm notifications by pushing new periods to other zones
class RGWProcessControlThread : public Thread {
RGWProcess *pprocess;
public:
- RGWProcessControlThread(RGWProcess *_pprocess) : pprocess(_pprocess) {}
+ explicit RGWProcessControlThread(RGWProcess *_pprocess) : pprocess(_pprocess) {}
void *entry() override {
pprocess->run();
public:
rgw_obj_select() : is_raw(false) {}
- rgw_obj_select(const rgw_obj& _obj) : obj(_obj), is_raw(false) {}
- rgw_obj_select(const rgw_raw_obj& _raw_obj) : raw_obj(_raw_obj), is_raw(true) {}
+ explicit rgw_obj_select(const rgw_obj& _obj) : obj(_obj), is_raw(false) {}
+ explicit rgw_obj_select(const rgw_raw_obj& _raw_obj) : raw_obj(_raw_obj), is_raw(true) {}
rgw_obj_select(const rgw_obj_select& rhs) {
placement_rule = rhs.placement_rule;
is_raw = rhs.is_raw;
JSONFormattable tier_config;
RGWZoneParams() : RGWSystemMetaObj() {}
- RGWZoneParams(const string& name) : RGWSystemMetaObj(name){}
+ explicit RGWZoneParams(const string& name) : RGWSystemMetaObj(name){}
RGWZoneParams(const string& id, const string& name) : RGWSystemMetaObj(id, name) {}
RGWZoneParams(const string& id, const string& name, const string& _realm_id)
: RGWSystemMetaObj(id, name), realm_id(_realm_id) {}
RGWZoneGroup(): is_master(false){}
RGWZoneGroup(const std::string &id, const std::string &name):RGWSystemMetaObj(id, name) {}
- RGWZoneGroup(const std::string &_name):RGWSystemMetaObj(_name) {}
+ explicit RGWZoneGroup(const std::string &_name):RGWSystemMetaObj(_name) {}
RGWZoneGroup(const std::string &_name, bool _is_master, CephContext *cct, RGWRados* store,
const string& _realm_id, const list<string>& _endpoints)
: RGWSystemMetaObj(_name, cct , store), endpoints(_endpoints), is_master(_is_master),
RWLock lock;
public:
- RGWObjectCtxImpl(RGWRados *_store) : store(_store), lock("RGWObjectCtxImpl") {}
+ explicit RGWObjectCtxImpl(RGWRados *_store) : store(_store), lock("RGWObjectCtxImpl") {}
S *get_state(const T& obj) {
S *result;
uint64_t pg_ver;
tombstone_entry() = default;
- tombstone_entry(const RGWObjState& state)
+ explicit tombstone_entry(const RGWObjState& state)
: mtime(state.mtime), zone_short_id(state.zone_short_id),
pg_ver(state.pg_ver) {}
};
class RGWRealmReloader::C_Reload : public Context {
RGWRealmReloader* reloader;
public:
- C_Reload(RGWRealmReloader* reloader) : reloader(reloader) {}
+ explicit C_Reload(RGWRealmReloader* reloader) : reloader(reloader) {}
void finish(int r) override { reloader->reload(); }
};
int do_wait();
public:
- RGWReshardWait(RGWRados *_store) : store(_store) {}
+ explicit RGWReshardWait(RGWRados *_store) : store(_store) {}
~RGWReshardWait() {
assert(going_down);
}
class StreamIntoBufferlist : public RGWGetDataCB {
bufferlist& bl;
public:
- StreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
+ explicit StreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
int handle_data(bufferlist& inbl, off_t bl_ofs, off_t bl_len) override {
bl.claim_append(inbl);
return bl_len;
RGWZoneGroupMap zonegroup_map;
bool old_format;
public:
- RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
+ explicit RGWOp_ZoneGroupMap_Get(bool _old_format):old_format(_old_format) {}
~RGWOp_ZoneGroupMap_Get() override {}
int verify_permission() override {
class RGWStreamIntoBufferlist : public RGWHTTPStreamRWRequest::ReceiveCB {
bufferlist& bl;
public:
- RGWStreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
+ explicit RGWStreamIntoBufferlist(bufferlist& _bl) : bl(_bl) {}
int handle_data(bufferlist& inbl, bool *pause) override {
bl.claim_append(inbl);
return inbl.length();
const rgw::auth::StrategyRegistry& auth_registry;
public:
- RGWHandler_Auth_S3(const rgw::auth::StrategyRegistry& auth_registry)
+ explicit RGWHandler_Auth_S3(const rgw::auth::StrategyRegistry& auth_registry)
: RGWHandler_REST(),
auth_registry(auth_registry) {
}
public:
static int init_from_header(struct req_state *s, int default_formatter, bool configurable_format);
- RGWHandler_REST_S3(const rgw::auth::StrategyRegistry& auth_registry)
+ explicit RGWHandler_REST_S3(const rgw::auth::StrategyRegistry& auth_registry)
: RGWHandler_REST(),
auth_registry(auth_registry) {
}
auth_data_t get_auth_data_v4(const req_state* s, const bool using_qs) const;
public:
- AWSGeneralAbstractor(CephContext* const cct)
+ explicit AWSGeneralAbstractor(CephContext* const cct)
: cct(cct) {
}
auth_data_t get_auth_data_v4(const req_state* s) const;
public:
- AWSBrowserUploadAbstractor(CephContext*) {
+ explicit AWSBrowserUploadAbstractor(CephContext*) {
}
auth_data_t get_auth_data(const req_state* s) const override;
RGWRados* const store;
public:
- S3AuthFactory(RGWRados* const store)
+ explicit S3AuthFactory(RGWRados* const store)
: store(store) {
}
class RGWMovedPermanently: public RGWOp {
const std::string location;
public:
- RGWMovedPermanently(const std::string& location)
+ explicit RGWMovedPermanently(const std::string& location)
: location(location) {
}
public:
/* Taking prefix_override by value to leverage std::string r-value ref
* ctor and thus avoid extra memory copying/increasing ref counter. */
- RGWWebsiteListing(std::string prefix_override)
+ explicit RGWWebsiteListing(std::string prefix_override)
: prefix_override(std::move(prefix_override)) {
}
};
static int init_from_header(struct req_state* s,
const std::string& frontend_prefix);
public:
- RGWHandler_REST_SWIFT(const rgw::auth::Strategy& auth_strategy)
+ explicit RGWHandler_REST_SWIFT(const rgw::auth::Strategy& auth_strategy)
: auth_strategy(auth_strategy) {
}
~RGWHandler_REST_SWIFT() override = default;
connection_map::iterator c;
std::vector<rgw_meta_sync_status>::iterator s;
public:
- MetaMasterStatusCollectCR(MasterTrimEnv& env)
+ explicit MetaMasterStatusCollectCR(MasterTrimEnv& env)
: RGWShardCollectCR(env.store->ctx(), MAX_CONCURRENT_SHARDS),
env(env), c(env.connections.begin()), s(env.peer_status.begin())
{}
int ret{0};
public:
- MetaMasterTrimCR(MasterTrimEnv& env)
+ explicit MetaMasterTrimCR(MasterTrimEnv& env)
: RGWCoroutine(env.store->ctx()), env(env)
{}
rgw_mdlog_info mdlog_info; //< master's mdlog info
public:
- MetaPeerTrimCR(PeerTrimEnv& env) : RGWCoroutine(env.store->ctx()), env(env) {}
+ explicit MetaPeerTrimCR(PeerTrimEnv& env) : RGWCoroutine(env.store->ctx()), env(env) {}
int operate();
};
void update_wait_time();
public:
- RGWSyncBackoff(int _max_secs = DEFAULT_BACKOFF_MAX) : cur_wait(0), max_secs(_max_secs) {}
+ explicit RGWSyncBackoff(int _max_secs = DEFAULT_BACKOFF_MAX) : cur_wait(0), max_secs(_max_secs) {}
void backoff_sleep();
void reset() {
RGWCoroutine *cr{nullptr};
public:
- RGWLastCallerWinsCR(CephContext *cct) : RGWOrderCallCR(cct) {}
+ explicit RGWLastCallerWinsCR(CephContext *cct) : RGWOrderCallCR(cct) {}
~RGWLastCallerWinsCR() {
if (cr) {
cr->put();
class Handler : public TrimNotifyHandler {
Server *const server;
public:
- Handler(Server *server) : server(server) {}
+ explicit Handler(Server *server) : server(server) {}
void handle(bufferlist::iterator& input, bufferlist& output) override;
};
class Handler : public TrimNotifyHandler {
Server *const server;
public:
- Handler(Server *server) : server(server) {}
+ explicit Handler(Server *server) : server(server) {}
void handle(bufferlist::iterator& input, bufferlist& output) override;
};
AWSSyncConfig conf;
string id;
- AWSSyncInstanceEnv(AWSSyncConfig& _conf) : conf(_conf) {}
+ explicit AWSSyncInstanceEnv(AWSSyncConfig& _conf) : conf(_conf) {}
void init(RGWDataSyncEnv *sync_env, uint64_t instance_id) {
char buf[32];
struct CompleteMultipartReq {
map<int, rgw_sync_aws_multipart_part_info> parts;
- CompleteMultipartReq(const map<int, rgw_sync_aws_multipart_part_info>& _parts) : parts(_parts) {}
+ explicit CompleteMultipartReq(const map<int, rgw_sync_aws_multipart_part_info>& _parts) : parts(_parts) {}
void dump_xml(Formatter *f) const {
for (auto p : parts) {
class RGWMetadataSearch_ObjStore_S3 : public RGWMetadataSearchOp {
public:
- RGWMetadataSearch_ObjStore_S3(const RGWSyncModuleInstanceRef& _sync_module) : RGWMetadataSearchOp(_sync_module) {
+ explicit RGWMetadataSearch_ObjStore_S3(const RGWSyncModuleInstanceRef& _sync_module) : RGWMetadataSearchOp(_sync_module) {
custom_prefix = "x-amz-meta-";
}
return nullptr;
}
public:
- RGWHandler_REST_MDSearch_S3(const rgw::auth::StrategyRegistry& auth_registry) : RGWHandler_REST_S3(auth_registry) {}
+ explicit RGWHandler_REST_MDSearch_S3(const rgw::auth::StrategyRegistry& auth_registry) : RGWHandler_REST_S3(auth_registry) {}
virtual ~RGWHandler_REST_MDSearch_S3() {}
};
class RGWLogDataSyncModule : public RGWDataSyncModule {
string prefix;
public:
- RGWLogDataSyncModule(const string& _prefix) : prefix(_prefix) {}
+ explicit RGWLogDataSyncModule(const string& _prefix) : prefix(_prefix) {}
RGWCoroutine *sync_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, uint64_t versioned_epoch, rgw_zone_set *zones_trace) override {
ldout(sync_env->cct, 0) << prefix << ": SYNC_LOG: sync_object: b=" << bucket_info.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch << dendl;
class RGWLogSyncModuleInstance : public RGWSyncModuleInstance {
RGWLogDataSyncModule data_handler;
public:
- RGWLogSyncModuleInstance(const string& prefix) : data_handler(prefix) {}
+ explicit RGWLogSyncModuleInstance(const string& prefix) : data_handler(prefix) {}
RGWDataSyncModule *get_data_handler() override {
return &data_handler;
}
}
public:
- HeaderView(const char (&header)[BLOCK_SIZE])
+ explicit HeaderView(const char (&header)[BLOCK_SIZE])
: header(reinterpret_cast<const header_t*>(header)) {
}
struct WatchCtx : public librados::WatchCtx2 {
librados::IoCtx *m_ioctx;
- WatchCtx(librados::IoCtx *ioctx) : m_ioctx(ioctx) {}
+ explicit WatchCtx(librados::IoCtx *ioctx) : m_ioctx(ioctx) {}
void handle_notify(uint64_t notify_id, uint64_t cookie,
uint64_t notifier_id, bufferlist& bl_) override {
bufferlist bl;
public:
int id;
Item() : id(0) {}
- Item(int i) : id(i) {}
+ explicit Item(int i) : id(i) {}
void set(int i) {id = i;}
};
value(0)
{}
Request(const Request& o) = default;
- Request(int value) :
+ explicit Request(int value) :
value(value)
{}
};
class great_grandchild : public grandchild {
public:
- great_grandchild(int val) : grandchild(val) {}
+ explicit great_grandchild(int val) : grandchild(val) {}
int call(int n) override { return n + val; }
};
ceph::real_time t;
public:
real_time_wrapper() = default;
- real_time_wrapper(const ceph::real_time& t) : t(t) {}
+ explicit real_time_wrapper(const ceph::real_time& t) : t(t) {}
void encode(bufferlist& bl) const {
using ceph::encode;
int ref_count;
const bool unlink; //< unlink objects on destruction
- Engine(thread_data* td);
+ explicit Engine(thread_data* td);
~Engine();
static Engine* get_instance(thread_data* td) {
class UnitComplete : public Context {
io_u* u;
public:
- UnitComplete(io_u* u) : u(u) {}
+ explicit UnitComplete(io_u* u) : u(u) {}
void finish(int r) {
// mark the pointer to indicate completion for fio_ceph_os_getevents()
u->engine_data = reinterpret_cast<void*>(1ull);
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
}
};
namespace {
struct MockReplayImageCtx : public MockImageCtx {
- MockReplayImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockReplayImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
+ explicit MockTestImageCtx(librbd::ImageCtx& image_ctx) : MockImageCtx(image_ctx) {
}
};
Watcher *watcher = static_cast<Watcher *>(arg);
watcher->handle_notify();
}
- Watcher(rbd_image_t &image) : m_image(image) {}
+ explicit Watcher(rbd_image_t &image) : m_image(image) {}
void handle_notify() {
rbd_image_info_t info;
ASSERT_EQ(0, rbd_stat(m_image, &info, sizeof(info)));
std::string name = get_temp_image_name();
uint64_t size = 2 << 20;
struct Watcher : public librbd::UpdateWatchCtx {
- Watcher(librbd::Image &image) : m_image(image) {
+ explicit Watcher(librbd::Image &image) : m_image(image) {
}
void handle_notify() override {
librbd::image_info_t info;
// simulate the image is open by rbd-mirror bootstrap
uint64_t handle;
struct MirrorWatcher : public librados::WatchCtx2 {
- MirrorWatcher(librados::IoCtx &ioctx) : m_ioctx(ioctx) {
+ explicit MirrorWatcher(librados::IoCtx &ioctx) : m_ioctx(ioctx) {
}
void handle_notify(uint64_t notify_id, uint64_t cookie,
uint64_t notifier_id, bufferlist& bl) override {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace librbd {
struct MockManagedLockImageCtx : public MockImageCtx {
- MockManagedLockImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {}
+ explicit MockManagedLockImageCtx(ImageCtx &image_ctx) : MockImageCtx(image_ctx) {}
};
namespace watcher {
std::vector<ZPage*> pages;
struct iovec* iovs;
- ZPageSet(int n) {
+ explicit ZPageSet(int n) {
pages.reserve(n);
iovs = (struct iovec*) calloc(n, sizeof(struct iovec));
for (int page_ix = 0; page_ix < n; ++page_ix) {
std::vector<ZPage*> pages;
struct iovec* iovs;
- ZPageSet(int n) {
+ explicit ZPageSet(int n) {
pages.reserve(n);
iovs = (struct iovec*) calloc(n, sizeof(struct iovec));
for (int page_ix = 0; page_ix < n; ++page_ix) {
namespace {
class CheckTextTable : public TextTable {
public:
- CheckTextTable(bool verbose) {
+ explicit CheckTextTable(bool verbose) {
for (int i = 0; i < 4; i++) {
define_column("", TextTable::LEFT, TextTable::LEFT);
}
static const int sleepus = 500;
public:
- C_poll(EventCenter *c): center(c), woken(false) {}
+ explicit C_poll(EventCenter *c): center(c), woken(false) {}
void do_request(uint64_t r) override {
woken = true;
}
std::random_device rd;
std::default_random_engine rng;
- RandomString(size_t s): slen(s), rng(rd()) {}
+ explicit RandomString(size_t s): slen(s), rng(rd()) {}
void prepare(size_t n) {
static const char alphabet[] =
"abcdefghijklmnopqrstuvwxyz"
class C_delete : public EventCallback {
T *ctxt;
public:
- C_delete(T *c): ctxt(c) {}
+ explicit C_delete(T *c): ctxt(c) {}
void do_request(uint64_t id) override {
delete ctxt;
delete this;
class Client_read_handle : public EventCallback {
Client *c;
public:
- Client_read_handle(Client *_c): c(_c) {}
+ explicit Client_read_handle(Client *_c): c(_c) {}
void do_request(uint64_t id) override {
c->do_read_request();
}
class Client_write_handle : public EventCallback {
Client *c;
public:
- Client_write_handle(Client *_c): c(_c) {}
+ explicit Client_write_handle(Client *_c): c(_c) {}
void do_request(uint64_t id) override {
c->do_write_request();
}
class Server_read_handle : public EventCallback {
Server *s;
public:
- Server_read_handle(Server *_s): s(_s) {}
+ explicit Server_read_handle(Server *_s): s(_s) {}
void do_request(uint64_t id) override {
s->do_read_request();
}
class Server_write_handle : public EventCallback {
Server *s;
public:
- Server_write_handle(Server *_s): s(_s) {}
+ explicit Server_write_handle(Server *_s): s(_s) {}
void do_request(uint64_t id) override {
s->do_write_request();
}
BmapEntityTmp() {
}
- BmapEntityTmp(int num) {
+ explicit BmapEntityTmp(int num) {
m_num = num;
m_len = num;
}
boost::scoped_ptr<ObjectStore> store;
ObjectStore::CollectionHandle ch;
- StoreTestFixture(const std::string& type)
+ explicit StoreTestFixture(const std::string& type)
: type(type), data_dir(type + ".test_temp_dir")
{}
struct RequiredPredicate : IsPGRecoverablePredicate {
unsigned required_size;
- RequiredPredicate(unsigned required_size) : required_size(required_size) {}
+ explicit RequiredPredicate(unsigned required_size) : required_size(required_size) {}
bool operator()(const set<pg_shard_t> &have) const override {
return have.size() >= required_size;
}
using namespace std;
struct MapPredicate {
map<int, pair<PastIntervals::osd_state_t, epoch_t>> states;
- MapPredicate(
+ explicit MapPredicate(
const vector<pair<int, pair<PastIntervals::osd_state_t, epoch_t>>> &_states)
: states(_states.begin(), _states.end()) {}
PastIntervals::osd_state_t operator()(epoch_t start, int osd, epoch_t *lost_at) {
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
Cond cond;
ImageIds image_ids;
- PoolWatcherListener(TestPoolWatcher *test) : test(test) {
+ explicit PoolWatcherListener(TestPoolWatcher *test) : test(test) {
}
void handle_update(const std::string &mirror_uuid,
namespace {
struct MockTestImageCtx : public librbd::MockImageCtx {
- MockTestImageCtx(librbd::ImageCtx &image_ctx)
+ explicit MockTestImageCtx(librbd::ImageCtx &image_ctx)
: librbd::MockImageCtx(image_ctx) {
}
};
data_pool = index_pool = s;
marker = "";
}
- old_rgw_bucket(const char *n) : name(n) {
+ explicit old_rgw_bucket(const char *n) : name(n) {
data_pool = index_pool = n;
marker = "";
}
const Principal id;
public:
- FakeIdentity(Principal&& id) : id(std::move(id)) {}
+ explicit FakeIdentity(Principal&& id) : id(std::move(id)) {}
uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override {
abort();
return 0;
class RecordingPuller : public RGWPeriodHistory::Puller {
const int error;
public:
- RecordingPuller(int error) : error(error) {}
+ explicit RecordingPuller(int error) : error(error) {}
Ids ids;
int pull(const std::string& id, RGWPeriod& period) override {
ids.push_back(id);
}
template<typename ...Args>
- not_noexcept(Args&& ...) noexcept(false) {
+ explicit not_noexcept(Args&& ...) noexcept(false) {
}
template<typename U, typename ...Args>
unmoving() noexcept {}
template<typename... Args>
- unmoving(Args&& ...args) noexcept
+ explicit unmoving(Args&& ...args) noexcept
: a(sizeof...(Args)) {}
template<typename U, typename... Args>
- unmoving(std::initializer_list<U> l) noexcept
+ explicit unmoving(std::initializer_list<U> l) noexcept
: a(-l.size()) {}
template<typename U, typename... Args>
decode(a, p);
}
legacy_t() {}
- legacy_t(int32_t i) : a(i) {}
+ explicit legacy_t(int32_t i) : a(i) {}
friend bool operator<(const legacy_t& l, const legacy_t& r) {
return l.a < r.a;
}
int a;
int b;
obj() : a(1), b(1) {}
- obj(int _a) : a(_a), b(2) {}
+ explicit obj(int _a) : a(_a), b(2) {}
obj(int _a,int _b) : a(_a), b(_b) {}
friend inline bool operator<(const obj& l, const obj& r) {
return l.a < r.a;