From: Chunmei Liu Date: Fri, 17 Jan 2020 23:09:10 +0000 (-0800) Subject: crimson:common add TOPNSPC namespace for ceph and crimson X-Git-Tag: v15.1.1~182^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a54d0a90c06aed1ae26826d7d5317ba13e18c86e;p=ceph.git crimson:common add TOPNSPC namespace for ceph and crimson some code coexist in crimson seastar environment and posix environment, so add namespace to avoid same function conflict, for example add namespace for CephContext, since the new namespace for classic ceph-osd, need modify all files declare use CephContext by including "common_fwd.h" which defined the namespace for each environment. Signed-off-by: Chunmei Liu --- diff --git a/src/auth/AuthAuthorizeHandler.h b/src/auth/AuthAuthorizeHandler.h index b6ac1b1b7d2b..fc4a8788628f 100644 --- a/src/auth/AuthAuthorizeHandler.h +++ b/src/auth/AuthAuthorizeHandler.h @@ -16,6 +16,7 @@ #define CEPH_AUTHAUTHORIZEHANDLER_H #include "Auth.h" +#include "include/common_fwd.h" #include "include/types.h" #include "common/ceph_mutex.h" // Different classes of session crypto handling @@ -24,7 +25,6 @@ #define SESSION_SYMMETRIC_AUTHENTICATE 1 #define SESSION_SYMMETRIC_ENCRYPT 2 -class CephContext; class KeyRing; struct AuthAuthorizeHandler { diff --git a/src/auth/AuthClientHandler.h b/src/auth/AuthClientHandler.h index 01de454e854d..3e2f73db049b 100644 --- a/src/auth/AuthClientHandler.h +++ b/src/auth/AuthClientHandler.h @@ -17,8 +17,8 @@ #include "auth/Auth.h" +#include "include/common_fwd.h" -class CephContext; struct MAuthReply; class RotatingKeyRing; diff --git a/src/auth/AuthMethodList.h b/src/auth/AuthMethodList.h index b5aae0bba490..e139218d35ff 100644 --- a/src/auth/AuthMethodList.h +++ b/src/auth/AuthMethodList.h @@ -15,14 +15,13 @@ #ifndef CEPH_AUTHMETHODLIST_H #define CEPH_AUTHMETHODLIST_H +#include "include/common_fwd.h" #include "include/int_types.h" #include #include #include -class CephContext; - class AuthMethodList { std::list<__u32> auth_supported; public: diff --git a/src/auth/AuthServer.h b/src/auth/AuthServer.h index 80b4e2114df7..d7ca304a6f1a 100644 --- a/src/auth/AuthServer.h +++ b/src/auth/AuthServer.h @@ -4,10 +4,10 @@ #pragma once #include "AuthRegistry.h" +#include "include/common_fwd.h" #include -class CephContext; class Connection; class AuthServer { diff --git a/src/auth/AuthServiceHandler.h b/src/auth/AuthServiceHandler.h index ed2c532f0284..ac33eaa24259 100644 --- a/src/auth/AuthServiceHandler.h +++ b/src/auth/AuthServiceHandler.h @@ -18,9 +18,9 @@ #include // for NULL #include // for uint64_t #include "common/entity_name.h" // for EntityName +#include "include/common_fwd.h" #include "include/buffer_fwd.h" // for ceph::buffer::list -class CephContext; class KeyServer; class CryptoKey; struct AuthCapsInfo; diff --git a/src/auth/AuthSessionHandler.h b/src/auth/AuthSessionHandler.h index 6e54f1cee00d..692ebc288946 100644 --- a/src/auth/AuthSessionHandler.h +++ b/src/auth/AuthSessionHandler.h @@ -16,6 +16,7 @@ #ifndef CEPH_AUTHSESSIONHANDLER_H #define CEPH_AUTHSESSIONHANDLER_H +#include "include/common_fwd.h" #include "include/types.h" #include "Auth.h" @@ -23,7 +24,6 @@ // Defines the security applied to ongoing messages in a session, once the session is established. PLR -class CephContext; class Message; struct AuthSessionHandler { diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc index f8ac5372f6a9..e45946341ac2 100644 --- a/src/auth/Crypto.cc +++ b/src/auth/Crypto.cc @@ -167,7 +167,7 @@ std::size_t CryptoKeyHandler::decrypt( sha256_digest_t CryptoKeyHandler::hmac_sha256( const ceph::bufferlist& in) const { - ceph::crypto::HMACSHA256 hmac((const unsigned char*)secret.c_str(), secret.length()); + TOPNSPC::crypto::HMACSHA256 hmac((const unsigned char*)secret.c_str(), secret.length()); for (const auto& bptr : in.buffers()) { hmac.Update((const unsigned char *)bptr.c_str(), bptr.length()); diff --git a/src/auth/Crypto.h b/src/auth/Crypto.h index dc03dfe44838..3691d97feee0 100644 --- a/src/auth/Crypto.h +++ b/src/auth/Crypto.h @@ -15,13 +15,13 @@ #ifndef CEPH_AUTH_CRYPTO_H #define CEPH_AUTH_CRYPTO_H +#include "include/common_fwd.h" #include "include/types.h" #include "include/utime.h" #include "include/buffer.h" #include -class CephContext; class CryptoKeyContext; namespace ceph { class Formatter; } diff --git a/src/auth/KeyRing.h b/src/auth/KeyRing.h index d5fe7fabbd49..5524cb792828 100644 --- a/src/auth/KeyRing.h +++ b/src/auth/KeyRing.h @@ -16,8 +16,7 @@ #define CEPH_KEYRING_H #include "auth/Auth.h" - -class CephContext; +#include "include/common_fwd.h" class KeyRing : public KeyStore { std::map keys; diff --git a/src/auth/RotatingKeyRing.h b/src/auth/RotatingKeyRing.h index 04277a8be850..534eb513608b 100644 --- a/src/auth/RotatingKeyRing.h +++ b/src/auth/RotatingKeyRing.h @@ -17,13 +17,13 @@ #include "common/ceph_mutex.h" #include "auth/Auth.h" +#include "include/common_fwd.h" /* * mediate access to a service's keyring and rotating secrets */ class KeyRing; -class CephContext; class RotatingKeyRing : public KeyStore { CephContext *cct; diff --git a/src/auth/cephx/CephxAuthorizeHandler.h b/src/auth/cephx/CephxAuthorizeHandler.h index c53af021b89e..b72b7c5e9cc7 100644 --- a/src/auth/cephx/CephxAuthorizeHandler.h +++ b/src/auth/cephx/CephxAuthorizeHandler.h @@ -16,8 +16,7 @@ #define CEPH_CEPHXAUTHORIZEHANDLER_H #include "auth/AuthAuthorizeHandler.h" - -class CephContext; +#include "include/common_fwd.h" struct CephxAuthorizeHandler : public AuthAuthorizeHandler { bool verify_authorizer( diff --git a/src/auth/cephx/CephxClientHandler.h b/src/auth/cephx/CephxClientHandler.h index cd1196a689ce..6b225e4aca30 100644 --- a/src/auth/cephx/CephxClientHandler.h +++ b/src/auth/cephx/CephxClientHandler.h @@ -18,8 +18,8 @@ #include "auth/AuthClientHandler.h" #include "CephxProtocol.h" #include "auth/RotatingKeyRing.h" +#include "include/common_fwd.h" -class CephContext; class KeyRing; class CephxClientHandler : public AuthClientHandler { diff --git a/src/auth/cephx/CephxKeyServer.h b/src/auth/cephx/CephxKeyServer.h index cd3cf1234678..59cd6932567e 100644 --- a/src/auth/cephx/CephxKeyServer.h +++ b/src/auth/cephx/CephxKeyServer.h @@ -19,8 +19,7 @@ #include "CephxProtocol.h" #include "CephxKeyServer.h" #include "common/ceph_mutex.h" - -class CephContext; +#include "include/common_fwd.h" struct KeyServerData { version_t version; diff --git a/src/auth/cephx/CephxProtocol.h b/src/auth/cephx/CephxProtocol.h index ebee32239e21..6c2d53a0951c 100644 --- a/src/auth/cephx/CephxProtocol.h +++ b/src/auth/cephx/CephxProtocol.h @@ -34,8 +34,7 @@ #include #include -class CephContext; - +#include "include/common_fwd.h" /* * Authentication */ diff --git a/src/auth/cephx/CephxSessionHandler.h b/src/auth/cephx/CephxSessionHandler.h index 6a6a99f18427..e09426f1a6cc 100644 --- a/src/auth/cephx/CephxSessionHandler.h +++ b/src/auth/cephx/CephxSessionHandler.h @@ -15,8 +15,8 @@ #include "auth/AuthSessionHandler.h" #include "auth/Auth.h" +#include "include/common_fwd.h" -class CephContext; class Message; class CephxSessionHandler : public AuthSessionHandler { diff --git a/src/auth/krb/KrbClientHandler.hpp b/src/auth/krb/KrbClientHandler.hpp index a8960a8898cb..9ab26a6905d8 100644 --- a/src/auth/krb/KrbClientHandler.hpp +++ b/src/auth/krb/KrbClientHandler.hpp @@ -18,6 +18,7 @@ #include "auth/AuthClientHandler.h" #include "auth/RotatingKeyRing.h" +#include "include/common_fwd.h" #include "KrbProtocol.hpp" @@ -27,7 +28,6 @@ #include -class CephContext; class Keyring; diff --git a/src/auth/none/AuthNoneAuthorizeHandler.h b/src/auth/none/AuthNoneAuthorizeHandler.h index d9abc769ef42..46586418980f 100644 --- a/src/auth/none/AuthNoneAuthorizeHandler.h +++ b/src/auth/none/AuthNoneAuthorizeHandler.h @@ -16,8 +16,7 @@ #define CEPH_AUTHNONEAUTHORIZEHANDLER_H #include "auth/AuthAuthorizeHandler.h" - -class CephContext; +#include "include/common_fwd.h" struct AuthNoneAuthorizeHandler : public AuthAuthorizeHandler { bool verify_authorizer( diff --git a/src/auth/none/AuthNoneProtocol.h b/src/auth/none/AuthNoneProtocol.h index 2a501efe5256..ea0b731f571d 100644 --- a/src/auth/none/AuthNoneProtocol.h +++ b/src/auth/none/AuthNoneProtocol.h @@ -16,8 +16,7 @@ #define CEPH_AUTHNONEPROTOCOL_H #include "auth/Auth.h" - -class CephContext; +#include "include/common_fwd.h" struct AuthNoneAuthorizer : public AuthAuthorizer { AuthNoneAuthorizer() : AuthAuthorizer(CEPH_AUTH_NONE) { } diff --git a/src/auth/none/AuthNoneServiceHandler.h b/src/auth/none/AuthNoneServiceHandler.h index 038c75e03be9..d8cc13ae5983 100644 --- a/src/auth/none/AuthNoneServiceHandler.h +++ b/src/auth/none/AuthNoneServiceHandler.h @@ -17,8 +17,7 @@ #include "auth/AuthServiceHandler.h" #include "auth/Auth.h" - -class CephContext; +#include "include/common_fwd.h" class AuthNoneServiceHandler : public AuthServiceHandler { public: diff --git a/src/client/Client.h b/src/client/Client.h index 2648390ea278..0ec989db2672 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -22,6 +22,7 @@ #include "common/ceph_mutex.h" #include "common/cmdparse.h" #include "common/compiler_extensions.h" +#include "include/common_fwd.h" #include "include/cephfs/ceph_statx.h" #include "include/filepath.h" #include "include/interval_set.h" @@ -53,7 +54,6 @@ class FSMap; class FSMapUser; class MonClient; -class CephContext; struct DirStat; struct LeaseStat; @@ -63,7 +63,6 @@ class Filer; class Objecter; class WritebackHandler; -class PerfCounters; class MDSMap; class Message; diff --git a/src/common/Finisher.h b/src/common/Finisher.h index 3b6f9e455230..f1060b0e4bf8 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -16,12 +16,12 @@ #define CEPH_FINISHER_H #include "include/Context.h" +#include "include/common_fwd.h" #include "common/Thread.h" #include "common/ceph_mutex.h" #include "common/perf_counters.h" #include "common/Cond.h" -class CephContext; /// Finisher queue length performance counter ID. enum { diff --git a/src/common/HeartbeatMap.h b/src/common/HeartbeatMap.h index 28e16662d3f3..65f8f94e9787 100644 --- a/src/common/HeartbeatMap.h +++ b/src/common/HeartbeatMap.h @@ -22,8 +22,7 @@ #include "common/ceph_time.h" #include "common/ceph_mutex.h" - -class CephContext; +#include "include/common_fwd.h" namespace ceph { diff --git a/src/common/MemoryModel.h b/src/common/MemoryModel.h index dc529b387b35..ee87c6f3bb50 100644 --- a/src/common/MemoryModel.h +++ b/src/common/MemoryModel.h @@ -15,7 +15,7 @@ #ifndef CEPH_MEMORYMODEL_H #define CEPH_MEMORYMODEL_H -class CephContext; +#include "include/common_fwd.h" class MemoryModel { public: diff --git a/src/common/OutputDataSocket.h b/src/common/OutputDataSocket.h index 682dfcc6cb65..5a6bc4ff9fca 100644 --- a/src/common/OutputDataSocket.h +++ b/src/common/OutputDataSocket.h @@ -17,9 +17,9 @@ #include "common/ceph_mutex.h" #include "common/Thread.h" +#include "include/common_fwd.h" #include "include/buffer.h" -class CephContext; class OutputDataSocket : public Thread { diff --git a/src/common/PluginRegistry.h b/src/common/PluginRegistry.h index 62020a963a8e..938fb6e16875 100644 --- a/src/common/PluginRegistry.h +++ b/src/common/PluginRegistry.h @@ -21,8 +21,7 @@ #include #include #include "common/ceph_mutex.h" - -class CephContext; +#include "include/common_fwd.h" extern "C" { const char *__ceph_plugin_version(); diff --git a/src/common/RefCountedObj.cc b/src/common/RefCountedObj.cc index e77b631d89ed..e4c3fef588ca 100644 --- a/src/common/RefCountedObj.cc +++ b/src/common/RefCountedObj.cc @@ -8,6 +8,7 @@ #include "common/dout.h" #include "common/valgrind.h" +namespace TOPNSPC::common { RefCountedObject::~RefCountedObject() { ceph_assert(nref == 0); @@ -38,3 +39,5 @@ void RefCountedObject::_get() const { << (v - 1) << " -> " << v << dendl; } } + +} diff --git a/src/common/RefCountedObj.h b/src/common/RefCountedObj.h index 5c0473c95980..49f29dcf8423 100644 --- a/src/common/RefCountedObj.h +++ b/src/common/RefCountedObj.h @@ -17,6 +17,7 @@ #include "common/ceph_mutex.h" #include "common/ref.h" +#include "include/common_fwd.h" #include @@ -39,10 +40,10 @@ * constructors. * */ - +namespace TOPNSPC::common { class RefCountedObject { public: - void set_cct(class CephContext *c) { + void set_cct(CephContext *c) { cct = c; } @@ -66,7 +67,7 @@ protected: RefCountedObject& operator=(const RefCountedObject& o) = delete; RefCountedObject(RefCountedObject&&) = delete; RefCountedObject& operator=(RefCountedObject&&) = delete; - RefCountedObject(class CephContext* c) : cct(c) {} + RefCountedObject(CephContext* c) : cct(c) {} virtual ~RefCountedObject(); @@ -79,7 +80,7 @@ private: // crimson is single threaded at the moment mutable uint64_t nref{1}; #endif - class CephContext *cct{nullptr}; + CephContext *cct{nullptr}; }; class RefCountedObjectSafe : public RefCountedObject { @@ -192,7 +193,7 @@ static inline void intrusive_ptr_add_ref(const RefCountedObject *p) { static inline void intrusive_ptr_release(const RefCountedObject *p) { p->put(); } - -using RefCountedPtr = ceph::ref_t; +} +using RefCountedPtr = ceph::ref_t; #endif diff --git a/src/common/Timer.h b/src/common/Timer.h index a2e979f363a1..61dad464b47f 100644 --- a/src/common/Timer.h +++ b/src/common/Timer.h @@ -16,10 +16,10 @@ #define CEPH_TIMER_H #include +#include "include/common_fwd.h" #include "ceph_time.h" #include "ceph_mutex.h" -class CephContext; class Context; class SafeTimerThread; diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index c687f52c57a8..21e9669bfb4c 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -35,10 +35,10 @@ struct ThreadPool { #include "common/config_obs.h" #include "common/HeartbeatMap.h" #include "common/Thread.h" +#include "include/common_fwd.h" #include "include/Context.h" #include "common/HBHandle.h" -class CephContext; /// Pool of threads that share work submitted to multiple work queues. class ThreadPool : public md_config_obs_t { diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index 8fa120fe7e89..1f57ca0832f1 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -43,6 +43,7 @@ using std::ostringstream; +using namespace TOPNSPC::common; /* * UNIX domain sockets created by an application persist even after that diff --git a/src/common/admin_socket.h b/src/common/admin_socket.h index 607dfc257a99..fad3e556fb9a 100644 --- a/src/common/admin_socket.h +++ b/src/common/admin_socket.h @@ -26,11 +26,11 @@ #include #include "include/buffer.h" +#include "include/common_fwd.h" #include "common/ref.h" #include "common/cmdparse.h" class AdminSocket; -class CephContext; class MCommand; class MMonCommand; diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 976b2cfbf906..389033429418 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -22,6 +22,7 @@ #include +#include "include/common_fwd.h" #include "include/mempool.h" #include "include/stringify.h" #include "common/admin_socket.h" @@ -55,6 +56,7 @@ using ceph::HeartbeatMap; #include #ifdef WITH_SEASTAR +namespace crimson::common { CephContext::CephContext() : _conf{crimson::common::local_conf()}, _perf_counters_collection{crimson::common::local_perf_coll()}, @@ -93,6 +95,7 @@ PerfCountersCollectionImpl* CephContext::get_perfcounters_collection() return _perf_counters_collection.get_perf_collection(); } +} #else // WITH_SEASTAR namespace { @@ -183,6 +186,7 @@ public: } // anonymous namespace +namespace ceph::common { class CephContextServiceThread : public Thread { public: @@ -244,7 +248,7 @@ private: bool _exit_thread; CephContext *_cct; }; - +} /** * observe logging config changes @@ -356,6 +360,7 @@ public: }; +namespace ceph::common { // cct config watcher class CephContextObs : public md_config_obs_t { CephContext *cct; @@ -398,6 +403,26 @@ public: } } }; +// perfcounter hooks + +class CephContextHook : public AdminSocketHook { + CephContext *m_cct; + +public: + explicit CephContextHook(CephContext *cct) : m_cct(cct) {} + + int call(std::string_view command, const cmdmap_t& cmdmap, + Formatter *f, + std::ostream& errss, + bufferlist& out) override { + try { + return m_cct->do_command(command, cmdmap, f, errss, &out); + } catch (const bad_cmd_get& e) { + return -EINVAL; + } + } +}; + bool CephContext::check_experimental_feature_enabled(const std::string& feat) { @@ -434,26 +459,6 @@ bool CephContext::check_experimental_feature_enabled(const std::string& feat, return enabled; } -// perfcounter hooks - -class CephContextHook : public AdminSocketHook { - CephContext *m_cct; - -public: - explicit CephContextHook(CephContext *cct) : m_cct(cct) {} - - int call(std::string_view command, const cmdmap_t& cmdmap, - Formatter *f, - std::ostream& errss, - bufferlist& out) override { - try { - return m_cct->do_command(command, cmdmap, f, errss, &out); - } catch (const bad_cmd_get& e) { - return -EINVAL; - } - } -}; - int CephContext::do_command(std::string_view command, const cmdmap_t& cmdmap, Formatter *f, std::ostream& ss, @@ -785,14 +790,14 @@ void CephContext::put() { void CephContext::init_crypto() { if (_crypto_inited++ == 0) { - ceph::crypto::init(); + TOPNSPC::crypto::init(); } } void CephContext::shutdown_crypto() { if (--_crypto_inited == 0) { - ceph::crypto::shutdown(g_code_env == CODE_ENVIRONMENT_LIBRARY); + TOPNSPC::crypto::shutdown(g_code_env == CODE_ENVIRONMENT_LIBRARY); } } @@ -983,4 +988,5 @@ void CephContext::notify_post_fork() for (auto &&t : _fork_watchers) t->handle_post_fork(); } +} #endif // WITH_SEASTAR diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 6b6e9482b997..88f94ff72280 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -25,6 +25,7 @@ #include #include +#include "include/common_fwd.h" #include "include/any.h" #include "common/cmdparse.h" @@ -42,12 +43,15 @@ #include "crush/CrushLocation.h" class AdminSocket; -class CephContextServiceThread; -class CephContextHook; -class CephContextObs; class CryptoHandler; class CryptoRandom; +namespace ceph::common { + class CephContextServiceThread; + class CephContextObs; + class CephContextHook; +} + namespace ceph { class PluginRegistry; class HeartbeatMap; @@ -57,6 +61,7 @@ namespace ceph { } #ifdef WITH_SEASTAR +namespace crimson::common { class CephContext { public: CephContext(); @@ -83,7 +88,11 @@ private: std::unique_ptr _crypto_random; unsigned nref; }; +} #else +#ifdef __cplusplus +namespace ceph::common { +#endif /* A CephContext represents the context held by a single library user. * There can be multiple CephContexts in the same process. * @@ -103,10 +112,10 @@ public: CephContext& operator =(CephContext&&) = delete; bool _finished = false; + ~CephContext(); // ref count! private: - ~CephContext(); std::atomic nref; public: CephContext *get() { @@ -325,7 +334,7 @@ private: md_config_obs_t *_lockdep_obs; public: - CrushLocation crush_location; + TOPNSPC::crush::CrushLocation crush_location; private: enum { @@ -361,6 +370,9 @@ private: friend class CephContextObs; }; +#ifdef __cplusplus +} +#endif #endif // WITH_SEASTAR #endif diff --git a/src/common/ceph_crypto.cc b/src/common/ceph_crypto.cc index 1b6d318b0900..cbeb1b06df61 100644 --- a/src/common/ceph_crypto.cc +++ b/src/common/ceph_crypto.cc @@ -27,7 +27,7 @@ # include #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ -namespace ceph::crypto::ssl { +namespace TOPNSPC::crypto::ssl { #if OPENSSL_VERSION_NUMBER < 0x10100000L static std::atomic_uint32_t crypto_refs; @@ -166,42 +166,45 @@ void zeroize_for_security(void* const s, const size_t n) { OPENSSL_cleanse(s, n); } -} // namespace ceph::crypto::openssl +} // namespace TOPNSPC::crypto::openssl -void ceph::crypto::init() { - ceph::crypto::ssl::init(); +namespace TOPNSPC::crypto { +void init() { + ssl::init(); } -void ceph::crypto::shutdown([[maybe_unused]] const bool shared) { - ceph::crypto::ssl::shutdown(); +void shutdown([[maybe_unused]] const bool shared) { + ssl::shutdown(); } -void ceph::crypto::zeroize_for_security(void* const s, const size_t n) { - ceph::crypto::ssl::zeroize_for_security(s, n); +void zeroize_for_security(void* const s, const size_t n) { + ssl::zeroize_for_security(s, n); } -ceph::crypto::ssl::OpenSSLDigest::OpenSSLDigest(const EVP_MD * _type) +ssl::OpenSSLDigest::OpenSSLDigest(const EVP_MD * _type) : mpContext(EVP_MD_CTX_create()) , mpType(_type) { this->Restart(); } -ceph::crypto::ssl::OpenSSLDigest::~OpenSSLDigest() { +ssl::OpenSSLDigest::~OpenSSLDigest() { EVP_MD_CTX_destroy(mpContext); } -void ceph::crypto::ssl::OpenSSLDigest::Restart() { +void ssl::OpenSSLDigest::Restart() { EVP_DigestInit_ex(mpContext, mpType, NULL); } -void ceph::crypto::ssl::OpenSSLDigest::Update(const unsigned char *input, size_t length) { +void ssl::OpenSSLDigest::Update(const unsigned char *input, size_t length) { if (length) { EVP_DigestUpdate(mpContext, const_cast(reinterpret_cast(input)), length); } } -void ceph::crypto::ssl::OpenSSLDigest::Final(unsigned char *digest) { +void ssl::OpenSSLDigest::Final(unsigned char *digest) { unsigned int s; EVP_DigestFinal_ex(mpContext, digest, &s); } + +} diff --git a/src/common/ceph_crypto.h b/src/common/ceph_crypto.h index 75464d409bd8..6bf344aa8f13 100644 --- a/src/common/ceph_crypto.h +++ b/src/common/ceph_crypto.h @@ -5,6 +5,7 @@ #include "acconfig.h" #include +#include "include/common_fwd.h" #include "include/buffer.h" #include "include/types.h" @@ -28,27 +29,22 @@ extern "C" { const EVP_MD *EVP_sha512(void); } -namespace ceph { - namespace crypto { - void assert_init(); - void init(); - void shutdown(bool shared=true); +namespace TOPNSPC::crypto { + void assert_init(); + void init(); + void shutdown(bool shared=true); - void zeroize_for_security(void *s, size_t n); - } -} + void zeroize_for_security(void *s, size_t n); -namespace ceph { - namespace crypto { - class DigestException : public std::runtime_error - { + class DigestException : public std::runtime_error + { public: DigestException(const char* what_arg) : runtime_error(what_arg) {} - }; + }; - namespace ssl { - class OpenSSLDigest { + namespace ssl { + class OpenSSLDigest { private: EVP_MD_CTX *mpContext; const EVP_MD *mpType; @@ -58,37 +54,33 @@ namespace ceph { void Restart(); void Update (const unsigned char *input, size_t length); void Final (unsigned char *digest); - }; + }; - class MD5 : public OpenSSLDigest { + class MD5 : public OpenSSLDigest { public: static constexpr size_t digest_size = CEPH_CRYPTO_MD5_DIGESTSIZE; MD5 () : OpenSSLDigest(EVP_md5()) { } - }; + }; - class SHA1 : public OpenSSLDigest { + class SHA1 : public OpenSSLDigest { public: static constexpr size_t digest_size = CEPH_CRYPTO_SHA1_DIGESTSIZE; SHA1 () : OpenSSLDigest(EVP_sha1()) { } - }; + }; - class SHA256 : public OpenSSLDigest { + class SHA256 : public OpenSSLDigest { public: static constexpr size_t digest_size = CEPH_CRYPTO_SHA256_DIGESTSIZE; SHA256 () : OpenSSLDigest(EVP_sha256()) { } - }; + }; - class SHA512 : public OpenSSLDigest { + class SHA512 : public OpenSSLDigest { public: static constexpr size_t digest_size = CEPH_CRYPTO_SHA512_DIGESTSIZE; SHA512 () : OpenSSLDigest(EVP_sha512()) { } - }; - } - } -} + }; -namespace ceph::crypto::ssl { # if OPENSSL_VERSION_NUMBER < 0x10100000L class HMAC { private: @@ -100,7 +92,7 @@ namespace ceph::crypto::ssl { : mpType(type) { // the strict FIPS zeroization doesn't seem to be necessary here. // just in the case. - ::ceph::crypto::zeroize_for_security(&mContext, sizeof(mContext)); + ::TOPNSPC::crypto::zeroize_for_security(&mContext, sizeof(mContext)); const auto r = HMAC_Init_ex(&mContext, key, length, mpType, nullptr); if (r != 1) { throw DigestException("HMAC_Init_ex() failed"); @@ -188,19 +180,14 @@ namespace ceph::crypto::ssl { } -namespace ceph { - namespace crypto { - using ceph::crypto::ssl::SHA256; - using ceph::crypto::ssl::MD5; - using ceph::crypto::ssl::SHA1; - using ceph::crypto::ssl::SHA512; + using ssl::SHA256; + using ssl::MD5; + using ssl::SHA1; + using ssl::SHA512; - using ceph::crypto::ssl::HMACSHA256; - using ceph::crypto::ssl::HMACSHA1; - } -} + using ssl::HMACSHA256; + using ssl::HMACSHA1; -namespace ceph::crypto { template auto digest(const ceph::buffer::list& bl) { diff --git a/src/common/cmdparse.cc b/src/common/cmdparse.cc index 598d95b57333..a19041845e1f 100644 --- a/src/common/cmdparse.cc +++ b/src/common/cmdparse.cc @@ -12,6 +12,7 @@ * */ +#include "include/common_fwd.h" #include "common/cmdparse.h" #include "common/Formatter.h" #include "common/debug.h" @@ -22,6 +23,7 @@ * Given a cmddesc like "foo baz name=bar,type=CephString", * return the prefix "foo baz". */ +namespace TOPNSPC::common { std::string cmddesc_get_prefix(const std::string_view &cmddesc) { string tmp(cmddesc); // FIXME: stringstream ctor can't take string_view :( @@ -661,4 +663,4 @@ bool cmd_getval(const cmdmap_t& cmdmap, return false; } - +} diff --git a/src/common/cmdparse.h b/src/common/cmdparse.h index 424ac812d7dc..2f9e85acf905 100644 --- a/src/common/cmdparse.h +++ b/src/common/cmdparse.h @@ -8,11 +8,10 @@ #include #include #include "include/ceph_assert.h" // boost clobbers this +#include "include/common_fwd.h" #include "common/Formatter.h" #include "common/BackTrace.h" -class CephContext; - typedef boost::variant> cmd_vartype; typedef std::map> cmdmap_t; +namespace TOPNSPC::common { std::string cmddesc_get_prefix(const std::string_view &cmddesc); std::string cmddesc_get_prenautilus_compat(const std::string &cmddesc); void dump_cmd_to_json(ceph::Formatter *f, uint64_t features, @@ -108,4 +108,5 @@ bool validate_cmd(CephContext* cct, extern int parse_osd_id(const char *s, std::ostream *pss); extern long parse_pos_long(const char *s, std::ostream *pss = NULL); +} #endif diff --git a/src/common/common_init.h b/src/common/common_init.h index 175dc5df672a..b9e1417396a5 100644 --- a/src/common/common_init.h +++ b/src/common/common_init.h @@ -17,10 +17,9 @@ #include +#include "include/common_fwd.h" #include "common/code_environment.h" -class CephContext; - enum common_init_flags_t { // Set up defaults that make sense for an unprivileged daemon CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS = 0x1, diff --git a/src/common/config.h b/src/common/config.h index b9765f86e1d7..e07993701ef0 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -24,8 +24,7 @@ #include "common/subsys_types.h" #include "common/config_tracker.h" #include "common/config_values.h" - -class CephContext; +#include "include/common_fwd.h" enum { CONF_DEFAULT, diff --git a/src/common/config_fwd.h b/src/common/config_fwd.h index c7e4c3f02a0b..f29a1324cb98 100644 --- a/src/common/config_fwd.h +++ b/src/common/config_fwd.h @@ -1,12 +1,9 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- #pragma once +#include "include/common_fwd.h" -#ifdef WITH_SEASTAR -namespace crimson::common { +namespace TOPNSPC::common { class ConfigProxy; } -using ConfigProxy = crimson::common::ConfigProxy; -#else -class ConfigProxy; -#endif +using TOPNSPC::common::ConfigProxy; diff --git a/src/common/config_proxy.h b/src/common/config_proxy.h index 0e3501aac322..025f0a0a3bfc 100644 --- a/src/common/config_proxy.h +++ b/src/common/config_proxy.h @@ -11,6 +11,7 @@ // @c ConfigProxy is a facade of multiple config related classes. it exposes // the legacy settings with arrow operator, and the new-style config with its // member methods. +namespace ceph::common{ class ConfigProxy { static ConfigValues get_config_values(const ConfigProxy &config_proxy) { std::lock_guard locker(config_proxy.lock); @@ -336,3 +337,5 @@ public: config.get_defaults_bl(values, bl); } }; + +} diff --git a/src/common/fd.h b/src/common/fd.h index 581e1b0a2471..718d59296090 100644 --- a/src/common/fd.h +++ b/src/common/fd.h @@ -15,7 +15,7 @@ #ifndef CEPH_COMMON_FD_H #define CEPH_COMMON_FD_H -class CephContext; +#include "include/common_fwd.h" void dump_open_fds(CephContext *cct); diff --git a/src/common/lockdep.h b/src/common/lockdep.h index 11f21f56045b..240347d02e3b 100644 --- a/src/common/lockdep.h +++ b/src/common/lockdep.h @@ -15,8 +15,7 @@ #ifndef CEPH_LOCKDEP_H #define CEPH_LOCKDEP_H -class CephContext; - +#include "include/common_fwd.h" extern bool g_lockdep; extern void lockdep_register_ceph_context(CephContext *cct); @@ -31,5 +30,4 @@ extern int lockdep_will_lock(const char *n, int id, bool force_backtrace=false, extern int lockdep_locked(const char *n, int id, bool force_backtrace=false); extern int lockdep_will_unlock(const char *n, int id); extern int lockdep_dump_locks(); - #endif diff --git a/src/common/mutex_debug.h b/src/common/mutex_debug.h index 551e284c3acd..4a0c2cbb447c 100644 --- a/src/common/mutex_debug.h +++ b/src/common/mutex_debug.h @@ -21,14 +21,12 @@ #include #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "ceph_time.h" #include "likely.h" #include "lockdep.h" -class CephContext; -class PerfCounters; - namespace ceph { namespace mutex_debug_detail { diff --git a/src/common/options.cc b/src/common/options.cc index 45b8e527f392..a5069568a409 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -7,6 +7,7 @@ // Helpers for validators #include "include/stringify.h" +#include "include/common_fwd.h" #include #include #include diff --git a/src/common/perf_counters.cc b/src/common/perf_counters.cc index 36105b0e6b91..dda589e1ca96 100644 --- a/src/common/perf_counters.cc +++ b/src/common/perf_counters.cc @@ -16,9 +16,11 @@ #include "common/perf_counters.h" #include "common/dout.h" #include "common/valgrind.h" +#include "include/common_fwd.h" using std::ostringstream; +namespace TOPNSPC::common { PerfCountersCollectionImpl::PerfCountersCollectionImpl() { } @@ -583,3 +585,4 @@ PerfCounters *PerfCountersBuilder::create_perf_counters() return ret; } +} diff --git a/src/common/perf_counters.h b/src/common/perf_counters.h index 8936468d910b..1f9391137e87 100644 --- a/src/common/perf_counters.h +++ b/src/common/perf_counters.h @@ -25,12 +25,15 @@ #include "common/perf_histogram.h" #include "include/utime.h" +#include "include/common_fwd.h" #include "common/ceph_mutex.h" #include "common/ceph_time.h" -class CephContext; -class PerfCountersBuilder; -class PerfCounters; +namespace TOPNSPC::common { + class CephContext; + class PerfCountersBuilder; + class PerfCounters; +} enum perfcounter_type_d : uint8_t { @@ -56,6 +59,7 @@ enum unit_t : uint8_t * In the future, we will probably get rid of the first/last arguments, since * PerfCountersBuilder can deduce them itself. */ +namespace TOPNSPC::common { class PerfCountersBuilder { public: @@ -109,7 +113,7 @@ public: prio_default = prio_; } - PerfCounters* create_perf_counters(); + TOPNSPC::common::PerfCounters* create_perf_counters(); private: PerfCountersBuilder(const PerfCountersBuilder &rhs); PerfCountersBuilder& operator=(const PerfCountersBuilder &rhs); @@ -117,7 +121,7 @@ private: const char *description, const char *nick, int prio, int ty, int unit=UNIT_NONE, std::unique_ptr> histogram = nullptr); - PerfCounters *m_perf_counters; + TOPNSPC::common::PerfCounters *m_perf_counters; int prio_default = 0; }; @@ -374,5 +378,5 @@ public: } }; - +} #endif diff --git a/src/common/perf_counters_collection.cc b/src/common/perf_counters_collection.cc index c8a7ec0114c4..d9af8a945bbe 100644 --- a/src/common/perf_counters_collection.cc +++ b/src/common/perf_counters_collection.cc @@ -2,6 +2,7 @@ #include "common/ceph_mutex.h" #include "common/ceph_context.h" +namespace ceph::common { /* PerfcounterCollection hold the lock for PerfCounterCollectionImp */ PerfCountersCollection::PerfCountersCollection(CephContext *cct) : m_cct(cct), @@ -58,3 +59,4 @@ void PerfCountersDeleter::operator()(PerfCounters* p) noexcept delete p; } +} diff --git a/src/common/perf_counters_collection.h b/src/common/perf_counters_collection.h index 53a8f34120e3..e4bd2cda3b0f 100644 --- a/src/common/perf_counters_collection.h +++ b/src/common/perf_counters_collection.h @@ -2,9 +2,9 @@ #include "common/perf_counters.h" #include "common/ceph_mutex.h" +#include "include/common_fwd.h" -class CephContext; - +namespace ceph::common { class PerfCountersCollection { CephContext *m_cct; @@ -40,7 +40,5 @@ public: PerfCountersDeleter(CephContext* cct) noexcept : cct(cct) {} void operator()(PerfCounters* p) noexcept; }; - -using PerfCountersRef = std::unique_ptr; - - +} +using PerfCountersRef = std::unique_ptr; diff --git a/src/common/pick_address.h b/src/common/pick_address.h index aa87e7c51eb2..2621fed8108d 100644 --- a/src/common/pick_address.h +++ b/src/common/pick_address.h @@ -6,7 +6,8 @@ #include #include -class CephContext; +#include "include/common_fwd.h" + struct entity_addr_t; class entity_addrvec_t; diff --git a/src/common/random_string.h b/src/common/random_string.h index 87c1644c0f2a..b5dd9825ebf4 100644 --- a/src/common/random_string.h +++ b/src/common/random_string.h @@ -17,8 +17,7 @@ #pragma once #include - -class CephContext; +#include "include/common_fwd.h" /* size should be the required string size + 1 */ int gen_rand_base64(CephContext *cct, char *dest, size_t size); diff --git a/src/compressor/Compressor.h b/src/compressor/Compressor.h index a696521ad674..8b26bacf178a 100644 --- a/src/compressor/Compressor.h +++ b/src/compressor/Compressor.h @@ -20,6 +20,7 @@ #include #include #include "include/ceph_assert.h" // boost clobbers this +#include "include/common_fwd.h" #include "include/buffer.h" #include "include/int_types.h" #ifdef HAVE_QATZIP @@ -28,7 +29,6 @@ class Compressor; typedef std::shared_ptr CompressorRef; -class CephContext; class Compressor { public: diff --git a/src/crimson/admin/admin_socket.cc b/src/crimson/admin/admin_socket.cc index 2d0131c3f887..1c677ff10795 100644 --- a/src/crimson/admin/admin_socket.cc +++ b/src/crimson/admin/admin_socket.cc @@ -15,6 +15,7 @@ #include "crimson/common/log.h" #include "crimson/net/Socket.h" +using namespace crimson::common; /** * A Crimson-wise version of the admin socket - implementation file * diff --git a/src/crimson/admin/osd_admin.cc b/src/crimson/admin/osd_admin.cc index f094e335e8f9..13f096e3ec62 100644 --- a/src/crimson/admin/osd_admin.cc +++ b/src/crimson/admin/osd_admin.cc @@ -17,6 +17,7 @@ #include "crimson/osd/osd.h" using crimson::osd::OSD; +using namespace crimson::common; namespace { seastar::logger& logger() diff --git a/src/crimson/common/perf_counters_collection.h b/src/crimson/common/perf_counters_collection.h index be32f6f1e53d..a19630247075 100644 --- a/src/crimson/common/perf_counters_collection.h +++ b/src/crimson/common/perf_counters_collection.h @@ -6,6 +6,7 @@ #include "common/perf_counters.h" #include +using crimson::common::PerfCountersCollectionImpl; namespace crimson::common { class PerfCountersCollection: public seastar::sharded { diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index c4464fc6f97c..03d57bb71aab 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -193,7 +193,7 @@ Connection::create_auth(crimson::auth::method_t protocol, const EntityName& name, uint32_t want_keys) { - static CephContext cct; + static crimson::common::CephContext cct; std::unique_ptr auth; auth.reset(AuthClientHandler::create(&cct, protocol, diff --git a/src/crimson/mon/MonClient.h b/src/crimson/mon/MonClient.h index 65665f7a4d88..1e764c9b98d7 100644 --- a/src/crimson/mon/MonClient.h +++ b/src/crimson/mon/MonClient.h @@ -107,7 +107,7 @@ private: const ceph::bufferlist& payload, ceph::bufferlist *reply) final; - CephContext cct; // for auth_registry + crimson::common::CephContext cct; // for auth_registry AuthRegistry auth_registry; crimson::common::AuthHandler& auth_handler; diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 3d2c91bbe1d1..e609990ad876 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -160,7 +160,7 @@ seastar::future<> OSD::mkfs(uuid_d osd_uuid, uuid_d cluster_fsid) namespace { entity_addrvec_t pick_addresses(int what) { entity_addrvec_t addrs; - CephContext cct; + crimson::common::CephContext cct; if (int r = ::pick_addresses(&cct, what, &addrs, -1); r < 0) { throw std::runtime_error("failed to pick address"); } @@ -355,7 +355,7 @@ seastar::future<> OSD::_add_me_to_crush() return std::max(.00001, double(total) / double(1ull << 40)); // TB } }(); - const CrushLocation loc{make_unique().get()}; + const crimson::crush::CrushLocation loc{make_unique().get()}; logger().info("{} crush location is {}", __func__, loc); string cmd = fmt::format(R"({{ "prefix": "osd crush create-or-move", diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 1ced9b22e77d..e5894b0734d3 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -98,7 +98,7 @@ public: std::ostream& gen_prefix(std::ostream& out) const final { return out << *this; } - CephContext *get_cct() const final { + crimson::common::CephContext *get_cct() const final { return shard_services.get_cct(); } unsigned get_subsys() const final { diff --git a/src/crimson/osd/shard_services.h b/src/crimson/osd/shard_services.h index f90e1fb54183..66ba0702714f 100644 --- a/src/crimson/osd/shard_services.h +++ b/src/crimson/osd/shard_services.h @@ -6,6 +6,7 @@ #include #include +#include "include/common_fwd.h" #include "osd_operation.h" #include "msg/MessageRef.h" #include "crimson/os/futurized_collection.h" @@ -29,7 +30,6 @@ namespace crimson::os { class FuturizedStore; } -class PerfCounters; class OSDMap; class PeeringCtx; class BufferedRecoveryMessages; @@ -48,7 +48,7 @@ class ShardServices { crimson::mgr::Client &mgrc; crimson::os::FuturizedStore &store; - CephContext cct; + crimson::common::CephContext cct; PerfCounters *perf = nullptr; PerfCounters *recoverystate_perf = nullptr; @@ -71,7 +71,7 @@ public: return store; } - CephContext *get_cct() { + crimson::common::CephContext *get_cct() { return &cct; } diff --git a/src/crush/CrushLocation.cc b/src/crush/CrushLocation.cc index 34058f892bd6..c53769aa1bd0 100644 --- a/src/crush/CrushLocation.cc +++ b/src/crush/CrushLocation.cc @@ -9,12 +9,15 @@ #include "include/str_list.h" #include "common/debug.h" #include "common/errno.h" +#include "include/common_fwd.h" #include "include/compat.h" #include "common/SubProcess.h" #include +namespace TOPNSPC::crush { + int CrushLocation::update_from_conf() { if (cct->_conf->crush_location.length()) @@ -142,3 +145,5 @@ std::ostream& operator<<(std::ostream& os, const CrushLocation& loc) } return os; } + +} diff --git a/src/crush/CrushLocation.h b/src/crush/CrushLocation.h index 36789bd782b5..678135c2e42a 100644 --- a/src/crush/CrushLocation.h +++ b/src/crush/CrushLocation.h @@ -9,8 +9,9 @@ #include #include "common/ceph_mutex.h" +#include "include/common_fwd.h" -class CephContext; +namespace TOPNSPC::crush { class CrushLocation { public: @@ -32,5 +33,5 @@ private: }; std::ostream& operator<<(std::ostream& os, const CrushLocation& loc); - +} #endif diff --git a/src/global/global_context.cc b/src/global/global_context.cc index 7a8825dcdc87..f6c2672371fc 100644 --- a/src/global/global_context.cc +++ b/src/global/global_context.cc @@ -24,6 +24,7 @@ /* * Global variables for use from process context. */ +namespace TOPNSPC::global { CephContext *g_ceph_context = NULL; ConfigProxy& g_conf() { #ifdef WITH_SEASTAR @@ -73,3 +74,4 @@ int note_io_error_event( g_eio_length = length; return 0; } +} diff --git a/src/global/global_context.h b/src/global/global_context.h index 7d32d8cfa5f4..9ded22054123 100644 --- a/src/global/global_context.h +++ b/src/global/global_context.h @@ -18,9 +18,9 @@ #include #include "common/config_fwd.h" +#include "include/common_fwd.h" -class CephContext; - +namespace TOPNSPC::global { extern CephContext *g_ceph_context; ConfigProxy& g_conf(); @@ -49,4 +49,6 @@ extern int note_io_error_event( unsigned long long offset, unsigned long long length); +} +using namespace TOPNSPC::global; #endif diff --git a/src/global/global_init.cc b/src/global/global_init.cc index 1c60534d3793..0afeddb12a5f 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -38,7 +38,6 @@ #define dout_context g_ceph_context #define dout_subsys ceph_subsys_ - static void global_init_set_globals(CephContext *cct) { g_ceph_context = cct; @@ -405,7 +404,7 @@ global_init(const std::map *defaults, return boost::intrusive_ptr{g_ceph_context, false}; } - +namespace TOPNSPC::common { void intrusive_ptr_add_ref(CephContext* cct) { cct->get(); @@ -415,7 +414,7 @@ void intrusive_ptr_release(CephContext* cct) { cct->put(); } - +} void global_print_banner(void) { output_ceph_version(); diff --git a/src/global/global_init.h b/src/global/global_init.h index fe6f557bb253..d1d6dbbddbfb 100644 --- a/src/global/global_init.h +++ b/src/global/global_init.h @@ -23,8 +23,6 @@ #include "common/code_environment.h" #include "common/common_init.h" -class CephContext; - /* * global_init is the first initialization function that * daemons and utility programs need to call. It takes care of a lot of @@ -40,8 +38,10 @@ global_init( const char *data_dir_option = 0, bool run_pre_init = true); -void intrusive_ptr_add_ref(CephContext* cct); -void intrusive_ptr_release(CephContext* cct); +namespace TOPNSPC::common { + void intrusive_ptr_add_ref(CephContext* cct); + void intrusive_ptr_release(CephContext* cct); +} // just the first half; enough to get config parsed but doesn't start up the // cct or log. @@ -104,5 +104,4 @@ int global_init_preload_erasure_code(const CephContext *cct); * print daemon startup banner/warning */ void global_print_banner(void); - #endif diff --git a/src/include/ceph_assert.h b/src/include/ceph_assert.h index ccf7fb47d03b..3d63ee3c1622 100644 --- a/src/include/ceph_assert.h +++ b/src/include/ceph_assert.h @@ -23,7 +23,7 @@ # include "acconfig.h" #endif -class CephContext; +#include "include/common_fwd.h" namespace ceph { diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index d574aee3700a..70018a2ee335 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -30,6 +30,10 @@ #include "ceph_statx.h" #ifdef __cplusplus +namespace ceph::common { + class CephContext; +} +using CephContext = ceph::common::CephContext; extern "C" { #endif @@ -89,12 +93,12 @@ typedef struct vinodeno_t { } vinodeno_t; typedef struct Fh Fh; +struct CephContext; #else /* _cplusplus */ struct inodeno_t; struct vinodeno_t; typedef struct vinodeno_t vinodeno; - #endif /* ! __cplusplus */ struct UserPerm; @@ -105,7 +109,6 @@ typedef struct Inode Inode; struct ceph_mount_info; struct ceph_dir_result; -struct CephContext; /* setattr mask bits */ #ifndef CEPH_SETATTR_MODE @@ -221,8 +224,11 @@ int ceph_create(struct ceph_mount_info **cmount, const char * const id); * @param conf reuse this pre-existing CephContext config * @returns 0 on success, negative error code on failure */ +#ifdef __cplusplus +int ceph_create_with_context(struct ceph_mount_info **cmount, CephContext *conf); +#else int ceph_create_with_context(struct ceph_mount_info **cmount, struct CephContext *conf); - +#endif #ifndef VOIDPTR_RADOS_T #define VOIDPTR_RADOS_T @@ -382,8 +388,11 @@ uint64_t ceph_get_instance_id(struct ceph_mount_info *cmount); * @param cmount the ceph mount handle to get the context from. * @returns the CephContext associated with the mount handle. */ +#ifdef __cplusplus +CephContext *ceph_get_mount_context(struct ceph_mount_info *cmount); +#else struct CephContext *ceph_get_mount_context(struct ceph_mount_info *cmount); - +#endif /* * Check mount status. * diff --git a/src/include/common_fwd.h b/src/include/common_fwd.h new file mode 100644 index 000000000000..e7ed9cae6a35 --- /dev/null +++ b/src/include/common_fwd.h @@ -0,0 +1,32 @@ +#pragma once + +#ifdef WITH_SEASTAR +#define TOPNSPC crimson +#else +#define TOPNSPC ceph +#endif + +namespace TOPNSPC::common { + class CephContext; + class PerfCounters; + class PerfCountersBuilder; + class PerfCountersCollection; + class PerfCountersCollectionImpl; + class PerfGuard; + class RefCountedObject; + class RefCountedObjectSafe; + class RefCountedCond; + class RefCountedWaitObject; + class ConfigProxy; +} +using TOPNSPC::common::CephContext; +using TOPNSPC::common::PerfCounters; +using TOPNSPC::common::PerfCountersBuilder; +using TOPNSPC::common::PerfCountersCollection; +using TOPNSPC::common::PerfCountersCollectionImpl; +using TOPNSPC::common::PerfGuard; +using TOPNSPC::common::RefCountedObject; +using TOPNSPC::common::RefCountedObjectSafe; +using TOPNSPC::common::RefCountedCond; +using TOPNSPC::common::RefCountedWaitObject; +using TOPNSPC::common::ConfigProxy; diff --git a/src/kv/LevelDBStore.h b/src/kv/LevelDBStore.h index 32680f73659b..90257f767bd5 100644 --- a/src/kv/LevelDBStore.h +++ b/src/kv/LevelDBStore.h @@ -27,12 +27,11 @@ #include "common/Cond.h" #include "common/ceph_context.h" +#include "include/common_fwd.h" // reinclude our assert to clobber the system one # include "include/ceph_assert.h" -class PerfCounters; - enum { l_leveldb_first = 34300, l_leveldb_gets, diff --git a/src/kv/MemDB.h b/src/kv/MemDB.h index 117b6aee88d6..56fb8cb5959f 100644 --- a/src/kv/MemDB.h +++ b/src/kv/MemDB.h @@ -15,6 +15,7 @@ #include #include #include +#include "include/common_fwd.h" #include "include/encoding.h" #include "include/btree_map.h" #include "KeyValueDB.h" @@ -23,7 +24,6 @@ using std::string; #define KEY_DELIM '\0' -class PerfCounters; enum { l_memdb_first = 34440, diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index ab0b38330abe..328277e52a34 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -22,6 +22,7 @@ using std::string; #include "common/perf_counters.h" #include "common/PriorityCache.h" +#include "include/common_fwd.h" #include "include/str_list.h" #include "include/stringify.h" #include "include/str_map.h" diff --git a/src/kv/RocksDBStore.h b/src/kv/RocksDBStore.h index a670ce549458..6c9c3387e39d 100644 --- a/src/kv/RocksDBStore.h +++ b/src/kv/RocksDBStore.h @@ -21,12 +21,12 @@ #include "common/errno.h" #include "common/dout.h" #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "common/Formatter.h" #include "common/Cond.h" #include "common/ceph_context.h" #include "common/PriorityCache.h" -class PerfCounters; enum { l_rocksdb_first = 34300, diff --git a/src/librados/RadosClient.h b/src/librados/RadosClient.h index 00520214a790..a3b8d20dfb48 100644 --- a/src/librados/RadosClient.h +++ b/src/librados/RadosClient.h @@ -19,6 +19,7 @@ #include "common/Timer.h" #include "common/ceph_mutex.h" #include "common/ceph_time.h" +#include "include/common_fwd.h" #include "include/rados/librados.h" #include "include/rados/librados.hpp" #include "mon/MonClient.h" @@ -29,7 +30,6 @@ struct AuthAuthorizer; struct Context; -class CephContext; struct Connection; class Message; class MLog; diff --git a/src/librados/snap_set_diff.h b/src/librados/snap_set_diff.h index d09a368a4cc8..33deeb3ae8d2 100644 --- a/src/librados/snap_set_diff.h +++ b/src/librados/snap_set_diff.h @@ -4,7 +4,7 @@ #ifndef __CEPH_OSDC_SNAP_SET_DIFF_H #define __CEPH_OSDC_SNAP_SET_DIFF_H -class CephContext; +#include "include/common_fwd.h" #include "include/rados/rados_types.hpp" #include "include/interval_set.h" diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index 5fe8cc3b4451..ecc4cdb400c5 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -20,6 +20,7 @@ #include "common/snap_types.h" #include "common/zipkin_trace.h" +#include "include/common_fwd.h" #include "include/buffer_fwd.h" #include "include/rbd/librbd.hpp" #include "include/rbd_types.h" @@ -34,10 +35,8 @@ #include #include -class CephContext; class ContextWQ; class Finisher; -class PerfCounters; class ThreadPool; class SafeTimer; diff --git a/src/librbd/TaskFinisher.h b/src/librbd/TaskFinisher.h index 67507efd0e41..76d41e6e5102 100644 --- a/src/librbd/TaskFinisher.h +++ b/src/librbd/TaskFinisher.h @@ -3,6 +3,7 @@ #ifndef LIBRBD_TASK_FINISHER_H #define LIBRBD_TASK_FINISHER_H +#include "include/common_fwd.h" #include "include/Context.h" #include "common/ceph_context.h" #include "common/Finisher.h" @@ -11,7 +12,6 @@ #include #include -class CephContext; namespace librbd { diff --git a/src/librbd/api/Config.h b/src/librbd/api/Config.h index daa718c97466..83225d287ebc 100644 --- a/src/librbd/api/Config.h +++ b/src/librbd/api/Config.h @@ -4,11 +4,11 @@ #ifndef CEPH_LIBRBD_API_CONFIG_H #define CEPH_LIBRBD_API_CONFIG_H +#include "common/config_fwd.h" +#include "include/common_fwd.h" #include "include/rbd/librbd.hpp" #include "include/rados/librados_fwd.hpp" -struct ConfigProxy; - namespace librbd { class ImageCtx; diff --git a/src/librbd/image/AttachChildRequest.h b/src/librbd/image/AttachChildRequest.h index d1450e8d7d1e..a40afaf544fd 100644 --- a/src/librbd/image/AttachChildRequest.h +++ b/src/librbd/image/AttachChildRequest.h @@ -4,10 +4,10 @@ #ifndef CEPH_LIBRBD_IMAGE_ATTACH_CHILD_REQUEST_H #define CEPH_LIBRBD_IMAGE_ATTACH_CHILD_REQUEST_H +#include "include/common_fwd.h" #include "include/int_types.h" #include "include/rados/librados.hpp" -class CephContext; class Context; namespace librbd { diff --git a/src/librbd/image/CloneRequest.h b/src/librbd/image/CloneRequest.h index 9a792657ba4e..1aa06d9c3c17 100644 --- a/src/librbd/image/CloneRequest.h +++ b/src/librbd/image/CloneRequest.h @@ -4,11 +4,11 @@ #ifndef CEPH_LIBRBD_IMAGE_CLONE_REQUEST_H #define CEPH_LIBRBD_IMAGE_CLONE_REQUEST_H -#include "include/rbd/librbd.hpp" #include "cls/rbd/cls_rbd_types.h" +#include "common/config_fwd.h" #include "librbd/internal.h" +#include "include/rbd/librbd.hpp" -class ConfigProxy; class Context; using librados::IoCtx; diff --git a/src/librbd/image/CreateRequest.h b/src/librbd/image/CreateRequest.h index 688e5c632a28..1b8ec77aa9dd 100644 --- a/src/librbd/image/CreateRequest.h +++ b/src/librbd/image/CreateRequest.h @@ -4,6 +4,7 @@ #ifndef CEPH_LIBRBD_IMAGE_CREATE_REQUEST_H #define CEPH_LIBRBD_IMAGE_CREATE_REQUEST_H +#include "common/config_fwd.h" #include "include/int_types.h" #include "include/buffer.h" #include "include/rados/librados.hpp" @@ -11,7 +12,6 @@ #include "cls/rbd/cls_rbd_types.h" #include "librbd/ImageCtx.h" -class ConfigProxy; class Context; class ContextWQ; diff --git a/src/librbd/image/ValidatePoolRequest.h b/src/librbd/image/ValidatePoolRequest.h index 8ea6e4a059d9..38c4de7c69a1 100644 --- a/src/librbd/image/ValidatePoolRequest.h +++ b/src/librbd/image/ValidatePoolRequest.h @@ -4,10 +4,10 @@ #ifndef CEPH_LIBRBD_IMAGE_VALIDATE_POOL_REQUEST_H #define CEPH_LIBRBD_IMAGE_VALIDATE_POOL_REQUEST_H +#include "include/common_fwd.h" #include "include/rados/librados.hpp" #include "include/buffer.h" -class CephContext; class Context; class ContextWQ; diff --git a/src/librbd/io/AioCompletion.h b/src/librbd/io/AioCompletion.h index 19e978edbbcf..cdaaa6a32b50 100644 --- a/src/librbd/io/AioCompletion.h +++ b/src/librbd/io/AioCompletion.h @@ -5,6 +5,7 @@ #define CEPH_LIBRBD_IO_AIO_COMPLETION_H #include "common/ceph_time.h" +#include "include/common_fwd.h" #include "include/Context.h" #include "include/utime.h" #include "include/rbd/librbd.hpp" @@ -18,7 +19,6 @@ #include #include -class CephContext; namespace librbd { namespace io { diff --git a/src/librbd/io/ReadResult.h b/src/librbd/io/ReadResult.h index ea62a05aabd5..67339caec85f 100644 --- a/src/librbd/io/ReadResult.h +++ b/src/librbd/io/ReadResult.h @@ -4,6 +4,7 @@ #ifndef CEPH_LIBRBD_IO_READ_RESULT_H #define CEPH_LIBRBD_IO_READ_RESULT_H +#include "include/common_fwd.h" #include "include/int_types.h" #include "include/buffer_fwd.h" #include "include/Context.h" @@ -12,7 +13,6 @@ #include #include -struct CephContext; namespace librbd { diff --git a/src/librbd/journal/Utils.h b/src/librbd/journal/Utils.h index d22044d10375..93643f9f9ee2 100644 --- a/src/librbd/journal/Utils.h +++ b/src/librbd/journal/Utils.h @@ -4,12 +4,12 @@ #ifndef CEPH_LIBRBD_JOURNAL_UTILS_H #define CEPH_LIBRBD_JOURNAL_UTILS_H +#include "include/common_fwd.h" #include "include/int_types.h" #include "include/Context.h" #include "cls/journal/cls_journal_types.h" #include -struct CephContext; namespace librbd { namespace journal { diff --git a/src/librbd/trash/MoveRequest.h b/src/librbd/trash/MoveRequest.h index f0d470c1b37a..d08011e852cb 100644 --- a/src/librbd/trash/MoveRequest.h +++ b/src/librbd/trash/MoveRequest.h @@ -4,12 +4,12 @@ #ifndef CEPH_LIBRBD_TRASH_MOVE_REQUEST_H #define CEPH_LIBRBD_TRASH_MOVE_REQUEST_H +#include "include/common_fwd.h" #include "include/utime.h" #include "include/rados/librados.hpp" #include "cls/rbd/cls_rbd_types.h" #include -struct CephContext; struct Context; namespace librbd { diff --git a/src/librbd/trash/RemoveRequest.h b/src/librbd/trash/RemoveRequest.h index 5f65a57ce9e9..f9ac0fdb945a 100644 --- a/src/librbd/trash/RemoveRequest.h +++ b/src/librbd/trash/RemoveRequest.h @@ -4,12 +4,12 @@ #ifndef CEPH_LIBRBD_TRASH_REMOVE_REQUEST_H #define CEPH_LIBRBD_TRASH_REMOVE_REQUEST_H +#include "include/common_fwd.h" #include "include/utime.h" #include "include/rados/librados.hpp" #include "cls/rbd/cls_rbd_types.h" #include -class CephContext; class Context; class ContextWQ; diff --git a/src/mds/FSMap.h b/src/mds/FSMap.h index 4e4c6e8b007f..feed962c8180 100644 --- a/src/mds/FSMap.h +++ b/src/mds/FSMap.h @@ -30,10 +30,10 @@ #include "include/CompatSet.h" #include "include/ceph_features.h" +#include "include/common_fwd.h" #include "common/Formatter.h" #include "mds/mdstypes.h" -class CephContext; class health_check_map_t; /** diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index b3443652cb35..2c841481e32b 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -19,6 +19,7 @@ #include #include "common/DecayCounter.h" +#include "include/common_fwd.h" #include "include/types.h" #include "include/filepath.h" #include "include/elist.h" @@ -61,8 +62,6 @@ #include "MDSMap.h" #include "Mutation.h" -class PerfCounters; - class MDSRank; class Session; class Migrator; diff --git a/src/mds/MDLog.h b/src/mds/MDLog.h index cd0960a31284..bb91c39e2cd7 100644 --- a/src/mds/MDLog.h +++ b/src/mds/MDLog.h @@ -14,6 +14,8 @@ #ifndef CEPH_MDLOG_H #define CEPH_MDLOG_H +#include "include/common_fwd.h" + enum { l_mdl_first = 5000, l_mdl_evadd, @@ -55,7 +57,6 @@ class LogEvent; class MDSRank; class LogSegment; class ESubtreeMap; -class PerfCounters; class MDLog { public: diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h index 36c7130cd22b..8c5f2bff77fc 100644 --- a/src/mds/MDSAuthCaps.h +++ b/src/mds/MDSAuthCaps.h @@ -19,6 +19,7 @@ #include #include +#include "include/common_fwd.h" #include "include/types.h" #include "common/debug.h" @@ -148,8 +149,6 @@ struct MDSCapGrant { bool network_valid = true; }; -class CephContext; - class MDSAuthCaps { public: diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 3a7e08c86a39..e7b1f51001e9 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -59,7 +59,7 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix *_dout << "mds." << name << ' ' - +using TOPNSPC::common::cmd_getval; // cons/des MDSDaemon::MDSDaemon(std::string_view n, Messenger *m, MonClient *mc) : Dispatcher(m->cct), @@ -192,7 +192,7 @@ void MDSDaemon::asok_command( try { mds_rank->handle_asok_command(command, cmdmap, f, inbl, on_finish); return; - } catch (const bad_cmd_get& e) { + } catch (const TOPNSPC::common::bad_cmd_get& e) { ss << e.what(); r = -EINVAL; } @@ -620,7 +620,7 @@ void MDSDaemon::handle_command(const cref_t &m) r = -EINVAL; ss << "no command given"; outs = ss.str(); - } else if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) { + } else if (!TOPNSPC::common::cmdmap_from_json(m->cmd, &cmdmap, ss)) { r = -EINVAL; outs = ss.str(); } else { diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index e9a5cd68300d..033f25bf3482 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -27,6 +27,7 @@ #include "include/ceph_features.h" #include "include/health.h" #include "include/CompatSet.h" +#include "include/common_fwd.h" #include "common/Clock.h" #include "common/Formatter.h" @@ -48,7 +49,6 @@ #define MDS_FS_NAME_DEFAULT "cephfs" -class CephContext; class health_check_map_t; class MDSMap { diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index e9accb557908..6c18068893d3 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -42,7 +42,7 @@ #define dout_subsys ceph_subsys_mds #undef dout_prefix #define dout_prefix *_dout << "mds." << whoami << '.' << incarnation << ' ' - +using TOPNSPC::common::cmd_getval; class C_Flush_Journal : public MDSInternalContext { public: C_Flush_Journal(MDCache *mdcache, MDLog *mdlog, MDSRank *mds, diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index acb11cfaceb3..9367034b6bde 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -22,6 +22,8 @@ #include "common/Timer.h" #include "common/TrackedOp.h" +#include "include/common_fwd.h" + #include "messages/MClientRequest.h" #include "messages/MCommand.h" #include "messages/MMDSMap.h" @@ -136,7 +138,7 @@ class MDSRank { friend class C_ScrubExecAndReply; friend class C_ScrubControlExecAndReply; - class CephContext *cct; + CephContext *cct; MDSRank( mds_rank_t whoami_, diff --git a/src/mds/RecoveryQueue.h b/src/mds/RecoveryQueue.h index cc2c69c905e5..699be08c385b 100644 --- a/src/mds/RecoveryQueue.h +++ b/src/mds/RecoveryQueue.h @@ -19,11 +19,11 @@ #include +#include "include/common_fwd.h" #include "osdc/Filer.h" class CInode; class MDSRank; -class PerfCounters; class RecoveryQueue { public: diff --git a/src/mds/Server.h b/src/mds/Server.h index 553bbd24ae04..12a9be819421 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -19,6 +19,8 @@ #include +#include "include/common_fwd.h" + #include "messages/MClientReconnect.h" #include "messages/MClientReply.h" #include "messages/MClientRequest.h" @@ -33,7 +35,6 @@ #include "MDSContext.h" class OSDMap; -class PerfCounters; class LogEvent; class EMetaBlob; class EUpdate; diff --git a/src/mds/StrayManager.h b/src/mds/StrayManager.h index fd64e50318cf..46335e1d4720 100644 --- a/src/mds/StrayManager.h +++ b/src/mds/StrayManager.h @@ -14,12 +14,12 @@ #ifndef STRAY_MANAGER_H #define STRAY_MANAGER_H +#include "include/common_fwd.h" #include "include/elist.h" #include #include "mds/PurgeQueue.h" class MDSRank; -class PerfCounters; class CInode; class CDentry; diff --git a/src/messages/MMgrReport.h b/src/messages/MMgrReport.h index d9ef4eee957d..c1a55d880cf6 100644 --- a/src/messages/MMgrReport.h +++ b/src/messages/MMgrReport.h @@ -22,6 +22,7 @@ #include "mgr/OSDPerfMetricTypes.h" #include "common/perf_counters.h" +#include "include/common_fwd.h" #include "mgr/DaemonHealthMetric.h" class PerfCounterType diff --git a/src/mgr/ActivePyModule.cc b/src/mgr/ActivePyModule.cc index 88d6502749c0..c776acfd03b5 100644 --- a/src/mgr/ActivePyModule.cc +++ b/src/mgr/ActivePyModule.cc @@ -206,7 +206,7 @@ int ActivePyModule::handle_command( Gil gil(py_module->pMyThreadState, true); PyFormatter f; - cmdmap_dump(cmdmap, &f); + TOPNSPC::common::cmdmap_dump(cmdmap, &f); PyObject *py_cmd = f.get(); string instr; inbuf.begin().copy(inbuf.length(), instr); diff --git a/src/mgr/ClusterState.cc b/src/mgr/ClusterState.cc index 2b54a5c24025..54c016dd3469 100644 --- a/src/mgr/ClusterState.cc +++ b/src/mgr/ClusterState.cc @@ -190,7 +190,7 @@ public: try { r = cluster_state->asok_command(admin_command, cmdmap, f, outss); out.append(outss); - } catch (const bad_cmd_get& e) { + } catch (const TOPNSPC::common::bad_cmd_get& e) { errss << e.what(); r = -EINVAL; } @@ -226,7 +226,7 @@ bool ClusterState::asok_command( if (admin_command == "dump_osd_network") { int64_t value = 0; // Default to health warning level if nothing specified - if (!(cmd_getval(cmdmap, "value", value))) { + if (!(TOPNSPC::common::cmd_getval(cmdmap, "value", value))) { // Convert milliseconds to microseconds value = static_cast(g_ceph_context->_conf.get_val("mon_warn_on_slow_ping_time")) * 1000; if (value == 0) { diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc index 06573211ba3c..ac28339e953d 100644 --- a/src/mgr/DaemonServer.cc +++ b/src/mgr/DaemonServer.cc @@ -43,7 +43,7 @@ #define dout_subsys ceph_subsys_mgr #undef dout_prefix #define dout_prefix *_dout << "mgr.server " << __func__ << " " - +using namespace TOPNSPC::common; namespace { template bool map_compare(Map const &lhs, Map const &rhs) { diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 4e4bbccec85c..a2ed644cdb23 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -40,6 +40,7 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, mon, get_last_committed()) +using namespace TOPNSPC::common; static ostream& _prefix(std::ostream *_dout, Monitor *mon, version_t v) { return *_dout << "mon." << mon->name << "@" << mon->rank << "(" << mon->get_state_name() diff --git a/src/mon/ConfigKeyService.cc b/src/mon/ConfigKeyService.cc index 9a33473f8de8..78a645bbbf08 100644 --- a/src/mon/ConfigKeyService.cc +++ b/src/mon/ConfigKeyService.cc @@ -27,6 +27,7 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, mon, this) +using namespace TOPNSPC::common; static ostream& _prefix(std::ostream *_dout, const Monitor *mon, const ConfigKeyService *service) { return *_dout << "mon." << mon->name << "@" << mon->rank @@ -195,7 +196,7 @@ bool ConfigKeyService::service_dispatch(MonOpRequestRef op) string prefix; cmdmap_t cmdmap; - if (!cmdmap_from_json(cmd->cmd, &cmdmap, ss)) { + if (!TOPNSPC::common::cmdmap_from_json(cmd->cmd, &cmdmap, ss)) { return false; } diff --git a/src/mon/ConfigMonitor.cc b/src/mon/ConfigMonitor.cc index 0a78bc6ad1cc..a67409fe9f8c 100644 --- a/src/mon/ConfigMonitor.cc +++ b/src/mon/ConfigMonitor.cc @@ -18,6 +18,7 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, mon, this) +using namespace TOPNSPC::common; static ostream& _prefix(std::ostream *_dout, const Monitor *mon, const ConfigMonitor *hmon) { return *_dout << "mon." << mon->name << "@" << mon->rank diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 06a43c7a815a..6581227b3b67 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -19,6 +19,7 @@ #include "MDSMonitor.h" #include "MgrStatMonitor.h" +using TOPNSPC::common::cmd_getval; static const string EXPERIMENTAL_WARNING("Warning! This feature is experimental." "It may cause problems up to and including data loss." diff --git a/src/mon/HealthMonitor.cc b/src/mon/HealthMonitor.cc index 3e3343796fb1..26ffad6e32e6 100644 --- a/src/mon/HealthMonitor.cc +++ b/src/mon/HealthMonitor.cc @@ -18,6 +18,7 @@ #include #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "include/stringify.h" #include "mon/Monitor.h" @@ -30,6 +31,7 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, mon, this) +using namespace TOPNSPC::common; static ostream& _prefix(std::ostream *_dout, const Monitor *mon, const HealthMonitor *hmon) { return *_dout << "mon." << mon->name << "@" << mon->rank diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 73f83230e565..bc4206fc0cc3 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -34,6 +34,8 @@ #define dout_subsys ceph_subsys_mon +using namespace TOPNSPC::common; + string LogMonitor::log_channel_info::get_log_file(const string &channel) { dout(25) << __func__ << " for channel '" diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 00ec6284bf45..230793be2335 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -42,6 +42,8 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, mon, get_fsmap()) +using namespace TOPNSPC::common; + static ostream& _prefix(std::ostream *_dout, Monitor *mon, const FSMap& fsmap) { return *_dout << "mon." << mon->name << "@" << mon->rank << "(" << mon->get_state_name() @@ -56,6 +58,7 @@ static const string MDS_HEALTH_PREFIX("mds_health"); * Specialized implementation of cmd_getval to allow us to parse * out strongly-typedef'd types */ +namespace TOPNSPC::common { template<> bool cmd_getval(const cmdmap_t& cmdmap, const std::string& k, mds_gid_t &val) { @@ -73,7 +76,7 @@ template<> bool cmd_getval(const cmdmap_t& cmdmap, { return cmd_getval(cmdmap, k, (int64_t&)val); } - +} // my methods template diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index 5e4bcd98f819..397c3700c21d 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -31,6 +31,7 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, mon, map) +using namespace TOPNSPC::common; static ostream& _prefix(std::ostream *_dout, Monitor *mon, const MgrMap& mgrmap) { return *_dout << "mon." << mon->name << "@" << mon->rank diff --git a/src/mon/MonCap.h b/src/mon/MonCap.h index 5f8227f4617b..edc1bda51a1f 100644 --- a/src/mon/MonCap.h +++ b/src/mon/MonCap.h @@ -6,11 +6,10 @@ #include +#include "include/common_fwd.h" #include "include/types.h" #include "common/entity_name.h" -class CephContext; - static const __u8 MON_CAP_R = (1 << 1); // read static const __u8 MON_CAP_W = (1 << 2); // write static const __u8 MON_CAP_X = (1 << 3); // execute diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 49acde967c5c..21f81b4f90ae 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -100,6 +100,7 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, this) +using namespace TOPNSPC::common; static ostream& _prefix(std::ostream *_dout, const Monitor *mon) { return *_dout << "mon." << mon->name << "@" << mon->rank << "(" << mon->get_state_name() << ") e" << mon->monmap->get_epoch() << " "; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index c9522334e0fd..fd8b14883624 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -48,6 +48,7 @@ #include "auth/cephx/CephxKeyServer.h" #include "auth/AuthMethodList.h" #include "auth/KeyRing.h" +#include "include/common_fwd.h" #include "messages/MMonCommand.h" #include "mon/MonitorDBStore.h" #include "mgr/MgrClient.h" @@ -99,7 +100,6 @@ enum { class QuorumService; class PaxosService; -class PerfCounters; class AdminSocketHook; #define COMPAT_SET_LOC "feature_set" diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index 55488ff315fd..9f52d5e6f7c9 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -29,6 +29,7 @@ #define dout_subsys ceph_subsys_mon #undef dout_prefix #define dout_prefix _prefix(_dout, mon) +using namespace TOPNSPC::common; static ostream& _prefix(std::ostream *_dout, Monitor *mon) { return *_dout << "mon." << mon->name << "@" << mon->rank << "(" << mon->get_state_name() diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index b4b2f5462e44..b4cc322b9f0b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -127,7 +127,7 @@ static const string OSD_SNAP_PREFIX("osd_snap"); -> map> */ - +using namespace TOPNSPC::common; namespace { struct OSDMemCache : public PriorityCache::PriCache { diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index d838ddd50bfb..636ab0c71563 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -31,6 +31,7 @@ using std::stringstream; using std::vector; using ceph::bufferlist; +using TOPNSPC::common::cmd_getval; MEMPOOL_DEFINE_OBJECT_FACTORY(PGMapDigest, pgmap_digest, pgmap); MEMPOOL_DEFINE_OBJECT_FACTORY(PGMap, pgmap, pgmap); diff --git a/src/msg/DispatchQueue.h b/src/msg/DispatchQueue.h index 97969de8abe4..243de2cba02e 100644 --- a/src/msg/DispatchQueue.h +++ b/src/msg/DispatchQueue.h @@ -20,6 +20,7 @@ #include #include #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "common/Throttle.h" #include "common/ceph_mutex.h" #include "common/Thread.h" @@ -27,7 +28,6 @@ #include "Message.h" -class CephContext; class Messenger; struct Connection; diff --git a/src/msg/Dispatcher.h b/src/msg/Dispatcher.h index 4c707da7d279..5e025437b535 100644 --- a/src/msg/Dispatcher.h +++ b/src/msg/Dispatcher.h @@ -19,12 +19,12 @@ #include #include "include/buffer_fwd.h" #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "msg/MessageRef.h" class Messenger; class Connection; class CryptoKey; -class CephContext; class KeyStore; class Dispatcher { diff --git a/src/msg/async/rdma/Infiniband.h b/src/msg/async/rdma/Infiniband.h index de776a87e8f0..3af89f304fe1 100644 --- a/src/msg/async/rdma/Infiniband.h +++ b/src/msg/async/rdma/Infiniband.h @@ -29,6 +29,7 @@ #include #include +#include "include/common_fwd.h" #include "include/int_types.h" #include "include/page.h" #include "include/scope_guard.h" @@ -57,7 +58,6 @@ struct ib_cm_meta_t { } __attribute__((packed)); class RDMAStack; -class CephContext; class Port { struct ibv_context* ctxt; diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index d3d13d04ba38..4abd333e16f1 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -14,6 +14,7 @@ #ifndef CEPH_OBJECTSTORE_H #define CEPH_OBJECTSTORE_H +#include "include/common_fwd.h" #include "include/Context.h" #include "include/buffer.h" #include "include/types.h" @@ -35,8 +36,6 @@ #include /* or */ #endif -class CephContext; - namespace ceph { class Formatter; } diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 0ef84b91b627..750354c8a280 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -28,6 +28,7 @@ #include "acconfig.h" #include "common/ceph_mutex.h" +#include "include/common_fwd.h" #if defined(HAVE_LIBAIO) || defined(HAVE_POSIXAIO) #include "ceph_aio.h" @@ -63,7 +64,6 @@ #define WRITE_LIFE_MAX 1 #endif -class CephContext; /// track in-flight io struct IOContext { diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index f54d9d254138..69f1bf756166 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -17,7 +17,7 @@ #define dout_subsys ceph_subsys_bluefs #undef dout_prefix #define dout_prefix *_dout << "bluefs " - +using TOPNSPC::common::cmd_getval; MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::File, bluefs_file, bluefs); MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::Dir, bluefs_dir, bluefs); MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::FileWriter, bluefs_file_writer, bluefs); diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 86e03bbfd37a..8045f39c4496 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -12,12 +12,11 @@ #include "common/RefCountedObj.h" #include "common/ceph_context.h" #include "global/global_context.h" +#include "include/common_fwd.h" #include "boost/intrusive/list.hpp" #include "boost/dynamic_bitset.hpp" -class PerfCounters; - class Allocator; enum { diff --git a/src/os/filestore/Journal.h b/src/os/filestore/Journal.h index 2c19ad478f0f..fe5c15dbf0a9 100644 --- a/src/os/filestore/Journal.h +++ b/src/os/filestore/Journal.h @@ -19,13 +19,13 @@ #include #include "include/buffer_fwd.h" +#include "include/common_fwd.h" #include "include/Context.h" #include "common/Finisher.h" #include "common/TrackedOp.h" #include "os/ObjectStore.h" #include "common/zipkin_trace.h" -class PerfCounters; class Journal { protected: diff --git a/src/os/filestore/WBThrottle.h b/src/os/filestore/WBThrottle.h index a7f6e1d65005..ed27e222b3ec 100644 --- a/src/os/filestore/WBThrottle.h +++ b/src/os/filestore/WBThrottle.h @@ -20,11 +20,11 @@ #include "common/Formatter.h" #include "common/hobject.h" #include "include/interval_set.h" +#include "include/common_fwd.h" #include "FDCache.h" #include "common/Thread.h" #include "common/ceph_context.h" -class PerfCounters; enum { l_wbthrottle_first = 999090, l_wbthrottle_bytes_dirtied, diff --git a/src/osd/ClassHandler.h b/src/osd/ClassHandler.h index cd992e082979..ac3f3c4aa3c3 100644 --- a/src/osd/ClassHandler.h +++ b/src/osd/ClassHandler.h @@ -6,17 +6,15 @@ #include #include "include/types.h" +#include "include/common_fwd.h" #include "common/ceph_mutex.h" #include "objclass/objclass.h" //forward declaration -class CephContext; - class ClassHandler { public: CephContext *cct; - struct ClassData; struct ClassMethod { diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 15197037179d..71b6e3de24c4 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -181,6 +181,7 @@ #define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch()) using namespace ceph::osd::scheduler; +using TOPNSPC::common::cmd_getval; static ostream& _prefix(std::ostream* _dout, int whoami, epoch_t epoch) { return *_dout << "osd." << whoami << " " << epoch << " "; @@ -2352,7 +2353,7 @@ public: std::function on_finish) override { try { osd->asok_command(prefix, cmdmap, f, inbl, on_finish); - } catch (const bad_cmd_get& e) { + } catch (const TOPNSPC::common::bad_cmd_get& e) { bufferlist empty; on_finish(-EINVAL, e.what(), empty); } @@ -2410,7 +2411,7 @@ void OSD::asok_command( pg->do_command(prefix, new_cmdmap, inbl, on_finish); pg->unlock(); return; // the pg handler calls on_finish directly - } catch (const bad_cmd_get& e) { + } catch (const TOPNSPC::common::bad_cmd_get& e) { pg->unlock(); ss << e.what(); ret = -EINVAL; @@ -3112,7 +3113,7 @@ public: try { test_ops(service, store, command, cmdmap, outss); out.append(outss); - } catch (const bad_cmd_get& e) { + } catch (const TOPNSPC::common::bad_cmd_get& e) { errss << e.what(); r = -EINVAL; } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index b1dfad86f359..59f84ed0bf3c 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -37,6 +37,7 @@ #include "osd/ClassHandler.h" #include "include/CompatSet.h" +#include "include/common_fwd.h" #include "OpRequest.h" #include "Session.h" @@ -74,7 +75,6 @@ class Messenger; class Message; class MonClient; -class PerfCounters; class ObjectStore; class FuseStore; class OSDMap; @@ -89,7 +89,6 @@ class TestOpsSocketHook; struct C_FinishSplits; struct C_OpenPGs; class LogChannel; -class CephContext; class MOSDOp; class MOSDPGCreate2; diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 05eee7ef7369..a4adf503dd39 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -27,6 +27,7 @@ #include "common/Formatter.h" #include "common/TextTable.h" #include "include/ceph_features.h" +#include "include/common_fwd.h" #include "include/str_map.h" #include "common/code_environment.h" @@ -5994,7 +5995,7 @@ int OSDMap::parse_osd_id_list(const vector& ls, set *out, get_all_osds(*out); break; } - long osd = parse_osd_id(i->c_str(), ss); + long osd = TOPNSPC::common::parse_osd_id(i->c_str(), ss); if (osd < 0) { *ss << "invalid osd id '" << *i << "'"; return -EINVAL; diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 15ce0ef7216c..cdbacbb1e631 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -32,6 +32,7 @@ #include #include "include/btree_map.h" +#include "include/common_fwd.h" #include "include/types.h" #include "common/ceph_releases.h" #include "osd_types.h" @@ -40,7 +41,6 @@ #include "crush/CrushWrapper.h" // forward declaration -class CephContext; class CrushWrapper; class health_check_map_t; diff --git a/src/osd/PG.h b/src/osd/PG.h index fd8905cf8e84..d187c3a630c2 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -28,6 +28,7 @@ // re-include our assert to clobber boost's #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "include/types.h" #include "include/stringify.h" @@ -70,7 +71,6 @@ class PG; struct OpRequest; typedef OpRequest::Ref OpRequestRef; class MOSDPGLog; -class CephContext; class DynamicPerfStats; namespace Scrub { diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 2990366f5df8..297e89d9a40a 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -18,6 +18,7 @@ // re-include our assert to clobber boost's #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "osd_types.h" #include "os/ObjectStore.h" #include @@ -37,8 +38,6 @@ constexpr auto PGLOG_INDEXED_ALL = PGLOG_INDEXED_OBJECTS | PGLOG_INDEXED_EXTRA_CALLER_OPS | PGLOG_INDEXED_DUPS; -class CephContext; - struct PGLog : DoutPrefixProvider { std::ostream& gen_prefix(std::ostream& out) const override { return out; diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 59eb5a5a4df0..160ca0090e1b 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -14,6 +14,7 @@ #include #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "PGLog.h" #include "PGStateUtils.h" diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 8e5b0c2dea93..bd7e822b2db3 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -63,6 +63,8 @@ #define DOUT_PREFIX_ARGS this, osd->whoami, get_osdmap() #undef dout_prefix #define dout_prefix _prefix(_dout, this) +using TOPNSPC::common::cmd_getval; + template static ostream& _prefix(std::ostream *_dout, T *pg) { return pg->gen_prefix(*_dout); diff --git a/src/osd/osd_perf_counters.cc b/src/osd/osd_perf_counters.cc index a1d9b2729d28..ed63b4d3f678 100644 --- a/src/osd/osd_perf_counters.cc +++ b/src/osd/osd_perf_counters.cc @@ -2,6 +2,8 @@ // vim: ts=8 sw=2 smarttab #include "osd_perf_counters.h" +#include "include/common_fwd.h" + PerfCounters *build_osd_logger(CephContext *cct) { PerfCountersBuilder osd_plb(cct, "osd", l_osd_first, l_osd_last); diff --git a/src/osd/osd_perf_counters.h b/src/osd/osd_perf_counters.h index 47ce2efebdd4..9966a7f7df3c 100644 --- a/src/osd/osd_perf_counters.h +++ b/src/osd/osd_perf_counters.h @@ -3,6 +3,7 @@ #pragma once +#include "include/common_fwd.h" #include "common/perf_counters.h" enum { diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h index 4bc5afad78a3..3e8f0f6650b8 100644 --- a/src/osdc/Journaler.h +++ b/src/osdc/Journaler.h @@ -65,10 +65,9 @@ #include "common/Timer.h" #include "common/Throttle.h" +#include "include/common_fwd.h" -class CephContext; class Context; -class PerfCounters; class Finisher; class C_OnFinisher; diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index 84e11f490fc8..bc6133651e93 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -7,6 +7,7 @@ #include "include/lru.h" #include "include/Context.h" #include "include/xlist.h" +#include "include/common_fwd.h" #include "common/Cond.h" #include "common/Finisher.h" @@ -16,9 +17,7 @@ #include "Objecter.h" #include "Striper.h" -class CephContext; class WritebackHandler; -class PerfCounters; enum { l_objectcacher_first = 25000, diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index fa421e33cd7f..8db785589010 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -26,6 +26,7 @@ #include #include "include/ceph_assert.h" +#include "include/common_fwd.h" #include "include/buffer.h" #include "include/types.h" #include "include/rados/rados_types.hpp" @@ -57,7 +58,6 @@ class MStatfsReply; class MCommandReply; class MWatchNotify; -class PerfCounters; // ----------------------------------------- diff --git a/src/osdc/Striper.h b/src/osdc/Striper.h index c7dc9c224fcc..85b99f08fd0b 100644 --- a/src/osdc/Striper.h +++ b/src/osdc/Striper.h @@ -15,11 +15,11 @@ #ifndef CEPH_STRIPER_H #define CEPH_STRIPER_H +#include "include/common_fwd.h" #include "include/types.h" #include "osd/osd_types.h" #include "osdc/StriperTypes.h" -class CephContext; //namespace ceph { diff --git a/src/rgw/rgw_amqp.h b/src/rgw/rgw_amqp.h index ff2b12073b33..bbfce2d5dcd6 100644 --- a/src/rgw/rgw_amqp.h +++ b/src/rgw/rgw_amqp.h @@ -7,7 +7,7 @@ #include #include -class CephContext; +#include "include/common_fwd.h" namespace rgw::amqp { // forward declaration of connection object diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 7ba410136f2d..aeceb05099d1 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -33,6 +33,7 @@ #include "services/svc_sync_modules.h" #include "services/svc_datalog_rados.h" +#include "include/common_fwd.h" #include "include/random.h" #include @@ -269,7 +270,7 @@ class RGWReadRemoteDataLogShardCR : public RGWCoroutine { bool *truncated; read_remote_data_log_response response; - std::optional timer; + std::optional timer; public: RGWReadRemoteDataLogShardCR(RGWDataSyncCtx *_sc, int _shard_id, diff --git a/src/rgw/rgw_kafka.h b/src/rgw/rgw_kafka.h index cccdd65b6ab6..569fb631d2bc 100644 --- a/src/rgw/rgw_kafka.h +++ b/src/rgw/rgw_kafka.h @@ -8,7 +8,7 @@ #include #include -class CephContext; +#include "include/common_fwd.h" namespace rgw::kafka { // forward declaration of connection object diff --git a/src/rgw/rgw_notify.h b/src/rgw/rgw_notify.h index 0dc666b365ed..64c759141518 100644 --- a/src/rgw/rgw_notify.h +++ b/src/rgw/rgw_notify.h @@ -5,10 +5,10 @@ #include #include "common/ceph_time.h" +#include "include/common_fwd.h" #include "rgw_notify_event_type.h" // forward declarations -class CephContext; namespace rgw::sal { class RGWRadosStore; } diff --git a/src/rgw/rgw_object_expirer_core.h b/src/rgw/rgw_object_expirer_core.h index 37fe80786bc5..9037c523e946 100644 --- a/src/rgw/rgw_object_expirer_core.h +++ b/src/rgw/rgw_object_expirer_core.h @@ -25,12 +25,12 @@ #include "global/global_init.h" +#include "include/common_fwd.h" #include "include/utime.h" #include "include/str_list.h" #include "rgw_sal.h" -class CephContext; class RGWSI_RADOS; class RGWSI_Zone; class RGWBucketInfo; diff --git a/src/rgw/rgw_perf_counters.h b/src/rgw/rgw_perf_counters.h index b6869803e71a..1307d36d7043 100644 --- a/src/rgw/rgw_perf_counters.h +++ b/src/rgw/rgw_perf_counters.h @@ -2,9 +2,7 @@ // vim: ts=8 sw=2 smarttab ft=cpp #pragma once - -class CephContext; -class PerfCounters; +#include "include/common_fwd.h" extern PerfCounters *perfcounter; diff --git a/src/rgw/rgw_period_puller.h b/src/rgw/rgw_period_puller.h index 4e1602915a88..d1a852cb9ef8 100644 --- a/src/rgw/rgw_period_puller.h +++ b/src/rgw/rgw_period_puller.h @@ -5,8 +5,8 @@ #define CEPH_RGW_PERIOD_PULLER_H #include "rgw_period_history.h" +#include "include/common_fwd.h" -class CephContext; class RGWPeriod; class RGWPeriodPuller : public RGWPeriodHistory::Puller { diff --git a/src/rgw/rgw_pubsub_push.h b/src/rgw/rgw_pubsub_push.h index 54f46f69c252..5a2f752c876b 100644 --- a/src/rgw/rgw_pubsub_push.h +++ b/src/rgw/rgw_pubsub_push.h @@ -6,13 +6,13 @@ #include #include #include "include/buffer_fwd.h" +#include "include/common_fwd.h" #include "common/async/yield_context.h" // TODO the env should be used as a template parameter to differentiate the source that triggers the pushes class RGWDataSyncEnv; class RGWCoroutine; class RGWHTTPArgs; -class CephContext; struct rgw_pubsub_event; struct rgw_pubsub_s3_record; diff --git a/src/rgw/rgw_reshard.h b/src/rgw/rgw_reshard.h index 8aa280f9def5..4bfbf5f810a6 100644 --- a/src/rgw/rgw_reshard.h +++ b/src/rgw/rgw_reshard.h @@ -13,6 +13,7 @@ #include #include +#include "include/common_fwd.h" #include "include/rados/librados.hpp" #include "common/ceph_time.h" #include "common/async/yield_context.h" @@ -22,7 +23,6 @@ #include "rgw_common.h" -class CephContext; class RGWReshard; namespace rgw { namespace sal { class RGWRadosStore; diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h index 0ea3827d38f2..5cbd3579a087 100644 --- a/src/rgw/rgw_rest_conn.h +++ b/src/rgw/rgw_rest_conn.h @@ -7,10 +7,10 @@ #include "rgw_rest_client.h" #include "common/ceph_json.h" #include "common/RefCountedObj.h" +#include "include/common_fwd.h" #include -class CephContext; class RGWSI_Zone; template diff --git a/src/rgw/rgw_trim_bilog.h b/src/rgw/rgw_trim_bilog.h index 8d4f76b8b2ed..c675112270fe 100644 --- a/src/rgw/rgw_trim_bilog.h +++ b/src/rgw/rgw_trim_bilog.h @@ -19,10 +19,10 @@ #include #include +#include "include/common_fwd.h" #include "include/encoding.h" #include "common/ceph_time.h" -class CephContext; class RGWCoroutine; class RGWHTTPManager; diff --git a/src/rgw/rgw_worker.h b/src/rgw/rgw_worker.h index c981d78b1552..5df99dbecfb4 100644 --- a/src/rgw/rgw_worker.h +++ b/src/rgw/rgw_worker.h @@ -22,8 +22,8 @@ #include "common/Thread.h" #include "common/ceph_mutex.h" +#include "include/common_fwd.h" -class CephContext; class RGWRados; class RGWRadosThread { diff --git a/src/test/admin_socket.cc b/src/test/admin_socket.cc index fb0a9d299277..eeea9c20bdbe 100644 --- a/src/test/admin_socket.cc +++ b/src/test/admin_socket.cc @@ -120,7 +120,7 @@ class MyTest : public AdminSocketHook { std::ostream& ss, bufferlist& result) override { std::vector args; - cmd_getval(cmdmap, "args", args); + TOPNSPC::common::cmd_getval(cmdmap, "args", args); result.append(command); result.append("|"); string resultstr; @@ -155,7 +155,7 @@ class MyTest2 : public AdminSocketHook { std::ostream& ss, bufferlist& result) override { std::vector args; - cmd_getval(cmdmap, "args", args); + TOPNSPC::common::cmd_getval(cmdmap, "args", args); result.append(command); result.append("|"); string resultstr; diff --git a/src/test/librados_test_stub/MockTestMemCluster.h b/src/test/librados_test_stub/MockTestMemCluster.h index 685621a8c75d..4a6da0cc0c54 100644 --- a/src/test/librados_test_stub/MockTestMemCluster.h +++ b/src/test/librados_test_stub/MockTestMemCluster.h @@ -4,11 +4,11 @@ #ifndef LIBRADOS_MOCK_TEST_MEM_CLUSTER_H #define LIBRADOS_MOCK_TEST_MEM_CLUSTER_H +#include "include/common_fwd.h" #include "test/librados_test_stub/TestMemCluster.h" #include "test/librados_test_stub/MockTestMemRadosClient.h" #include "gmock/gmock.h" -struct CephContext; namespace librados { diff --git a/src/test/librados_test_stub/TestCluster.h b/src/test/librados_test_stub/TestCluster.h index d7a31b6c08ad..9b7612d31db1 100644 --- a/src/test/librados_test_stub/TestCluster.h +++ b/src/test/librados_test_stub/TestCluster.h @@ -5,8 +5,7 @@ #define CEPH_TEST_CLUSTER_H #include "test/librados_test_stub/TestWatchNotify.h" - -class CephContext; +#include "include/common_fwd.h" namespace librados { diff --git a/src/tools/rbd_mirror/ServiceDaemon.h b/src/tools/rbd_mirror/ServiceDaemon.h index 8df1bda8f5c4..8b1e0f584546 100644 --- a/src/tools/rbd_mirror/ServiceDaemon.h +++ b/src/tools/rbd_mirror/ServiceDaemon.h @@ -5,12 +5,12 @@ #define CEPH_RBD_MIRROR_SERVICE_DAEMON_H #include "common/ceph_mutex.h" +#include "include/common_fwd.h" #include "tools/rbd_mirror/Types.h" #include "tools/rbd_mirror/service_daemon/Types.h" #include #include -struct CephContext; struct Context; namespace librbd { struct ImageCtx; } diff --git a/src/tools/rbd_mirror/Threads.h b/src/tools/rbd_mirror/Threads.h index d6a55579f63d..04e1848b503b 100644 --- a/src/tools/rbd_mirror/Threads.h +++ b/src/tools/rbd_mirror/Threads.h @@ -4,9 +4,9 @@ #ifndef CEPH_RBD_MIRROR_THREADS_H #define CEPH_RBD_MIRROR_THREADS_H +#include "include/common_fwd.h" #include "common/ceph_mutex.h" -class CephContext; class ContextWQ; class SafeTimer; class ThreadPool; diff --git a/src/tools/rbd_mirror/Throttler.h b/src/tools/rbd_mirror/Throttler.h index ae689de4838d..32080238aea2 100644 --- a/src/tools/rbd_mirror/Throttler.h +++ b/src/tools/rbd_mirror/Throttler.h @@ -13,8 +13,8 @@ #include "common/ceph_mutex.h" #include "common/config_obs.h" +#include "include/common_fwd.h" -class CephContext; class Context; namespace ceph { class Formatter; }