]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson:common add TOPNSPC namespace for ceph and crimson
authorChunmei Liu <chunmei.liu@intel.com>
Fri, 17 Jan 2020 23:09:10 +0000 (15:09 -0800)
committerChunmei Liu <chunmei.liu@intel.com>
Fri, 28 Feb 2020 03:56:29 +0000 (19:56 -0800)
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 <chunmei.liu@intel.com>
158 files changed:
src/auth/AuthAuthorizeHandler.h
src/auth/AuthClientHandler.h
src/auth/AuthMethodList.h
src/auth/AuthServer.h
src/auth/AuthServiceHandler.h
src/auth/AuthSessionHandler.h
src/auth/Crypto.cc
src/auth/Crypto.h
src/auth/KeyRing.h
src/auth/RotatingKeyRing.h
src/auth/cephx/CephxAuthorizeHandler.h
src/auth/cephx/CephxClientHandler.h
src/auth/cephx/CephxKeyServer.h
src/auth/cephx/CephxProtocol.h
src/auth/cephx/CephxSessionHandler.h
src/auth/krb/KrbClientHandler.hpp
src/auth/none/AuthNoneAuthorizeHandler.h
src/auth/none/AuthNoneProtocol.h
src/auth/none/AuthNoneServiceHandler.h
src/client/Client.h
src/common/Finisher.h
src/common/HeartbeatMap.h
src/common/MemoryModel.h
src/common/OutputDataSocket.h
src/common/PluginRegistry.h
src/common/RefCountedObj.cc
src/common/RefCountedObj.h
src/common/Timer.h
src/common/WorkQueue.h
src/common/admin_socket.cc
src/common/admin_socket.h
src/common/ceph_context.cc
src/common/ceph_context.h
src/common/ceph_crypto.cc
src/common/ceph_crypto.h
src/common/cmdparse.cc
src/common/cmdparse.h
src/common/common_init.h
src/common/config.h
src/common/config_fwd.h
src/common/config_proxy.h
src/common/fd.h
src/common/lockdep.h
src/common/mutex_debug.h
src/common/options.cc
src/common/perf_counters.cc
src/common/perf_counters.h
src/common/perf_counters_collection.cc
src/common/perf_counters_collection.h
src/common/pick_address.h
src/common/random_string.h
src/compressor/Compressor.h
src/crimson/admin/admin_socket.cc
src/crimson/admin/osd_admin.cc
src/crimson/common/perf_counters_collection.h
src/crimson/mon/MonClient.cc
src/crimson/mon/MonClient.h
src/crimson/osd/osd.cc
src/crimson/osd/pg.h
src/crimson/osd/shard_services.h
src/crush/CrushLocation.cc
src/crush/CrushLocation.h
src/global/global_context.cc
src/global/global_context.h
src/global/global_init.cc
src/global/global_init.h
src/include/ceph_assert.h
src/include/cephfs/libcephfs.h
src/include/common_fwd.h [new file with mode: 0644]
src/kv/LevelDBStore.h
src/kv/MemDB.h
src/kv/RocksDBStore.cc
src/kv/RocksDBStore.h
src/librados/RadosClient.h
src/librados/snap_set_diff.h
src/librbd/ImageCtx.h
src/librbd/TaskFinisher.h
src/librbd/api/Config.h
src/librbd/image/AttachChildRequest.h
src/librbd/image/CloneRequest.h
src/librbd/image/CreateRequest.h
src/librbd/image/ValidatePoolRequest.h
src/librbd/io/AioCompletion.h
src/librbd/io/ReadResult.h
src/librbd/journal/Utils.h
src/librbd/trash/MoveRequest.h
src/librbd/trash/RemoveRequest.h
src/mds/FSMap.h
src/mds/MDCache.h
src/mds/MDLog.h
src/mds/MDSAuthCaps.h
src/mds/MDSDaemon.cc
src/mds/MDSMap.h
src/mds/MDSRank.cc
src/mds/MDSRank.h
src/mds/RecoveryQueue.h
src/mds/Server.h
src/mds/StrayManager.h
src/messages/MMgrReport.h
src/mgr/ActivePyModule.cc
src/mgr/ClusterState.cc
src/mgr/DaemonServer.cc
src/mon/AuthMonitor.cc
src/mon/ConfigKeyService.cc
src/mon/ConfigMonitor.cc
src/mon/FSCommands.cc
src/mon/HealthMonitor.cc
src/mon/LogMonitor.cc
src/mon/MDSMonitor.cc
src/mon/MgrMonitor.cc
src/mon/MonCap.h
src/mon/Monitor.cc
src/mon/Monitor.h
src/mon/MonmapMonitor.cc
src/mon/OSDMonitor.cc
src/mon/PGMap.cc
src/msg/DispatchQueue.h
src/msg/Dispatcher.h
src/msg/async/rdma/Infiniband.h
src/os/ObjectStore.h
src/os/bluestore/BlockDevice.h
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h
src/os/filestore/Journal.h
src/os/filestore/WBThrottle.h
src/osd/ClassHandler.h
src/osd/OSD.cc
src/osd/OSD.h
src/osd/OSDMap.cc
src/osd/OSDMap.h
src/osd/PG.h
src/osd/PGLog.h
src/osd/PeeringState.h
src/osd/PrimaryLogPG.cc
src/osd/osd_perf_counters.cc
src/osd/osd_perf_counters.h
src/osdc/Journaler.h
src/osdc/ObjectCacher.h
src/osdc/Objecter.h
src/osdc/Striper.h
src/rgw/rgw_amqp.h
src/rgw/rgw_data_sync.cc
src/rgw/rgw_kafka.h
src/rgw/rgw_notify.h
src/rgw/rgw_object_expirer_core.h
src/rgw/rgw_perf_counters.h
src/rgw/rgw_period_puller.h
src/rgw/rgw_pubsub_push.h
src/rgw/rgw_reshard.h
src/rgw/rgw_rest_conn.h
src/rgw/rgw_trim_bilog.h
src/rgw/rgw_worker.h
src/test/admin_socket.cc
src/test/librados_test_stub/MockTestMemCluster.h
src/test/librados_test_stub/TestCluster.h
src/tools/rbd_mirror/ServiceDaemon.h
src/tools/rbd_mirror/Threads.h
src/tools/rbd_mirror/Throttler.h

index b6ac1b1b7d2b82686087ab92ed5aa4bc5aac3e4b..fc4a8788628f84c552f07decc1c03dace7f298bc 100644 (file)
@@ -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 {
index 01de454e854d2a4e2fea2c757f53aa921ec72534..3e2f73db049b47ca7a3817129a6cffb742d5e6ad 100644 (file)
@@ -17,8 +17,8 @@
 
 
 #include "auth/Auth.h"
+#include "include/common_fwd.h"
 
-class CephContext;
 struct MAuthReply;
 class RotatingKeyRing;
 
index b5aae0bba4909197dab67a187079529aadc569e9..e139218d35ff11fcba4c7db069821ecd1183d525 100644 (file)
 #ifndef CEPH_AUTHMETHODLIST_H
 #define CEPH_AUTHMETHODLIST_H
 
+#include "include/common_fwd.h"
 #include "include/int_types.h"
 
 #include <list>
 #include <set>
 #include <string>
 
-class CephContext;
-
 class AuthMethodList {
   std::list<__u32> auth_supported;
 public:
index 80b4e2114df7d2d448fdd6d29fa0e4c3ebeffe2c..d7ca304a6f1a9a451cf8de78c332529349306e69 100644 (file)
@@ -4,10 +4,10 @@
 #pragma once
 
 #include "AuthRegistry.h"
+#include "include/common_fwd.h"
 
 #include <vector>
 
-class CephContext;
 class Connection;
 
 class AuthServer {
index ed2c532f0284006b1966c5bb3eda1bf31570a9a7..ac33eaa2425946eda980342eb811cf3a4b7e8c65 100644 (file)
@@ -18,9 +18,9 @@
 #include <stddef.h>              // for NULL
 #include <stdint.h>              // 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;
index 6e54f1cee00dfe5ece84863646babc79f99967db..692ebc288946ee43b16921a8ff931f364519aca8 100644 (file)
@@ -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 {
index f8ac5372f6a94275f5b092bdd1538f460eb14178..e45946341ac25f8ffc8f78c1924ea1480988e32e 100644 (file)
@@ -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());
index dc03dfe448387966f11d31c7ab237970bd569d6d..3691d97feee0f80c8ac37add93e960003da3e65f 100644 (file)
 #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 <string>
 
-class CephContext;
 class CryptoKeyContext;
 namespace ceph { class Formatter; }
 
index d5fe7fabbd4916389d3ab73a820c9471094d75a9..5524cb7928284d69b9e7726237dca36a951161a0 100644 (file)
@@ -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<EntityName, EntityAuth> keys;
index 04277a8be8502069900a02cb4822890c6e4c978c..534eb513608b4e4cc89d2cc70d285d1952e3e915 100644 (file)
 
 #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;
index c53af021b89ed202d934a4550aac2df4ab931efe..b72b7c5e9cc702404be6f3f652fd4e5bc287c155 100644 (file)
@@ -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(
index cd1196a689ce2cae6abea8fc3acbdb802d2f558c..6b225e4aca30d5d15531bb5afdf64fd7c04c2d0a 100644 (file)
@@ -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 {
index cd3cf1234678fc7f2893fb2a03a47c4c45973446..59cd6932567e6be4cf3826c9e44e79b299a5794d 100644 (file)
@@ -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;
index ebee32239e21f93f572fd134a0dbc937526dd9e7..6c2d53a0951c59668dd45150cb97ad11ef39a007 100644 (file)
@@ -34,8 +34,7 @@
 #include <errno.h>
 #include <sstream>
 
-class CephContext;
-
+#include "include/common_fwd.h"
 /*
  * Authentication
  */
index 6a6a99f18427e4a250ba1849897ca12ead14c3b3..e09426f1a6cc6554c56ea7f672cd37ea213224e0 100644 (file)
@@ -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 {
index a8960a8898cbd7f372c658267ddb84410437e479..9ab26a6905d8e0e6c4d20b074d187af63196c4e5 100644 (file)
@@ -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 <gssapi/gssapi_ext.h>
 
 
-class CephContext;
 class Keyring;
 
 
index d9abc769ef429dd5d3f5b3003f14831db8c39b93..46586418980fb2cd61b6aeb86107338f3ecf68e3 100644 (file)
@@ -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(
index 2a501efe5256b5ad9f688048e5d1a645f35898bc..ea0b731f571d0a48e752a0d8a9748917cff7131c 100644 (file)
@@ -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) { }
index 038c75e03be9783bcd0b4ce3680ee44d79e92338..d8cc13ae5983ea2dc738104a5112ddc09e2c617d 100644 (file)
@@ -17,8 +17,7 @@
 
 #include "auth/AuthServiceHandler.h"
 #include "auth/Auth.h"
-
-class CephContext;
+#include "include/common_fwd.h"
 
 class AuthNoneServiceHandler  : public AuthServiceHandler {
 public:
index 2648390ea2784715dc675938a7b7dd4c2d3ebc7f..0ec989db2672b881b9f18c1e4d78804016a41441 100644 (file)
@@ -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;
 
index 3b6f9e45523080b69ac183ea5cb6cfaaa5bfc9ee..f1060b0e4bf87b3a12057bbf313f7cf524f99e91 100644 (file)
 #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 {
index 28e16662d3f3e0d85b87b82f33bde59a05720254..65f8f94e97871dd5898d6963828a1395cc983dd6 100644 (file)
@@ -22,8 +22,7 @@
 
 #include "common/ceph_time.h"
 #include "common/ceph_mutex.h"
-
-class CephContext;
+#include "include/common_fwd.h"
 
 namespace ceph {
 
index dc529b387b35dd6011209685671d06f121f26bf2..ee87c6f3bb50cabd88f11e5b8e2182f0b9ee2290 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef CEPH_MEMORYMODEL_H
 #define CEPH_MEMORYMODEL_H
 
-class CephContext;
+#include "include/common_fwd.h"
 
 class MemoryModel {
 public:
index 682dfcc6cb6503e98378ffb086f6ac996f170113..5a6bc4ff9fca81fbc51426cc82613f57a63abb26 100644 (file)
@@ -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
 {
index 62020a963a8e883ae60fbe4bcdf1e646110b3fb7..938fb6e16875dac96ba68165bddd0d027aa8e85b 100644 (file)
@@ -21,8 +21,7 @@
 #include <map>
 #include <string>
 #include "common/ceph_mutex.h"
-
-class CephContext;
+#include "include/common_fwd.h"
 
 extern "C" {
   const char *__ceph_plugin_version();
index e77b631d89ed00b4198d579a6e9edcdaa5a84add..e4c3fef588cad185c9ecef0e5693cda710232fbe 100644 (file)
@@ -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;
   }
 }
+
+}
index 5c0473c95980050c150caef4747b1a87635149a9..49f29dcf84231c2eddf85b2628e6c67a89c366c8 100644 (file)
@@ -17,6 +17,7 @@
  
 #include "common/ceph_mutex.h"
 #include "common/ref.h"
+#include "include/common_fwd.h"
 
 #include <atomic>
 
  * 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<RefCountedObject>;
+}
+using RefCountedPtr = ceph::ref_t<TOPNSPC::common::RefCountedObject>;
 
 #endif
index a2e979f363a1cd5d514d82f03d7642f165f45310..61dad464b47f3493a1b29e8c1e3fa0ba4db471ad 100644 (file)
 #define CEPH_TIMER_H
 
 #include <map>
+#include "include/common_fwd.h"
 #include "ceph_time.h"
 #include "ceph_mutex.h"
 
-class CephContext;
 class Context;
 class SafeTimerThread;
 
index c687f52c57a890125808ae2b47946462509cecc9..21e9669bfb4c66e07214646e88e3f011deddf9d2 100644 (file)
@@ -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 {
index 8fa120fe7e89bde318c01a71b838e510891f2aee..1f57ca0832f1f637dd800cb8ea5c32d616892705 100644 (file)
@@ -43,6 +43,7 @@
 
 
 using std::ostringstream;
+using namespace TOPNSPC::common;
 
 /*
  * UNIX domain sockets created by an application persist even after that
index 607dfc257a99c5ad426fcd442401e3d71fd28193..fad3e556fb9a55696afaf2c734447b7090b273e8 100644 (file)
 #include <thread>
 
 #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;
 
index 976b2cfbf9068ad1cab4010d9a60e8ee6dda5f1a..389033429418a0c669bc3a9bde0f7a3557ae713e 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <boost/algorithm/string.hpp>
 
+#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 <pthread.h>
 
 #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
index 6b6e9482b997e0fcf82922ddd922adfb87c025a8..88f94ff72280d01b26e1f853a38c7bae69188aef 100644 (file)
@@ -25,6 +25,7 @@
 #include <typeinfo>
 #include <typeindex>
 
+#include "include/common_fwd.h"
 #include "include/any.h"
 
 #include "common/cmdparse.h"
 #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<CryptoRandom> _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<unsigned> 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
index 1b6d318b0900298d438469bff1cba96ff7ab69df..cbeb1b06df615f621e287a05d236ba174544eb1d 100644 (file)
@@ -27,7 +27,7 @@
 #  include <openssl/err.h>
 #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<void *>(reinterpret_cast<const void *>(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);
 }
+
+}
index 75464d409bd8dcf5cdf14d36e9c7fc5318ea122d..6bf344aa8f13f1d03b9ff256048bb3f1219123fa 100644 (file)
@@ -5,6 +5,7 @@
 #include "acconfig.h"
 #include <stdexcept>
 
+#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<class Digest>
 auto digest(const ceph::buffer::list& bl)
 {
index 598d95b57333cc10d281ce09dfd6854aac2eb423..a19041845e1fe352dc7a572be01c762ea8bc4581 100644 (file)
@@ -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;
 }
 
-
+}
index 424ac812d7dc5cb64407965ff6f70e55f7bf02b3..2f9e85acf9052e1e07a476a08e58f6b33cf904d4 100644 (file)
@@ -8,11 +8,10 @@
 #include <ostream>
 #include <boost/variant.hpp>
 #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<std::string,
                       bool,
                       int64_t,
@@ -22,6 +21,7 @@ typedef boost::variant<std::string,
                       std::vector<double>>  cmd_vartype;
 typedef std::map<std::string, cmd_vartype, std::less<>> 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
index 175dc5df672a82210acbcac132fb42efb5ce9f32..b9e1417396a55303e85af6a9e5bd27bc98e42021 100644 (file)
 
 #include <deque>
 
+#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,
index b9765f86e1d7c467cc5c1269305754090a561f7b..e07993701ef0fe7dba655831b4b119d11e77210c 100644 (file)
@@ -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,
index c7e4c3f02a0be71c9d869afcec6f25eba3c0daae..f29a1324cb98f861335a7edf655d8523f2de04fb 100644 (file)
@@ -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;
index 0e3501aac322cb662e86eaf91e633ee4a750cdb9..025f0a0a3bfc0ede43d44a025fb5a46f2bc2f167 100644 (file)
@@ -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);
   }
 };
+
+}
index 581e1b0a24719e74ba56b95b71ac53ae8c52fd84..718d59296090348bde4ce56f3f943be849c994e6 100644 (file)
@@ -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);
 
index 11f21f56045b9bf8866a82ff34c0174989d2fb12..240347d02e3b2996322294ab234b7088b7c6cbb5 100644 (file)
@@ -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
index 551e284c3acd2c4357c9365f38fee7143afd01b9..4a0c2cbb447cd1061451d6377fd508ef040e9d6a 100644 (file)
 #include <pthread.h>
 
 #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 {
 
index 45b8e527f392ebf435a224616df6ecc9816e5ce8..a5069568a4090bc17ac2e474be929fcc4a5c09f5 100644 (file)
@@ -7,6 +7,7 @@
 
 // Helpers for validators
 #include "include/stringify.h"
+#include "include/common_fwd.h"
 #include <boost/algorithm/string.hpp>
 #include <boost/lexical_cast.hpp>
 #include <regex>
index 36105b0e6b91917a32be28ab2f75c15e967a062e..dda589e1ca96cfc737ea39653efb5e014ae2c0dc 100644 (file)
 #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;
 }
 
+}
index 8936468d910b3626e0fdd44a1ee3ace11859c244..1f9391137e876547ec452f4abfe63ac9fb16b5d3 100644 (file)
 
 #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<PerfHistogram<>> histogram = nullptr);
 
-  PerfCounters *m_perf_counters;
+  TOPNSPC::common::PerfCounters *m_perf_counters;
 
   int prio_default = 0;
 };
@@ -374,5 +378,5 @@ public:
   }
 };
 
-
+}
 #endif
index c8a7ec0114c4a6727c48132dce71457f312a937f..d9af8a945bbe0738890d3ae183bd63aa5e17ccc6 100644 (file)
@@ -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;
 }
 
+}
index 53a8f34120e3d5006a37e955c2267a238361eb1a..e4bd2cda3b0f1c25a741ccb7bccecb458bc3fa4c 100644 (file)
@@ -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<PerfCounters, PerfCountersDeleter>;
-
-
+}
+using PerfCountersRef = std::unique_ptr<ceph::common::PerfCounters, ceph::common::PerfCountersDeleter>;
index aa87e7c51eb2d6b5db1a687cc1bf07a961d6a619..2621fed8108db1182cc03912c8b2767734dfe75d 100644 (file)
@@ -6,7 +6,8 @@
 #include <string>
 #include <list>
 
-class CephContext;
+#include "include/common_fwd.h"
+
 struct entity_addr_t;
 class entity_addrvec_t;
 
index 87c1644c0f2a35340698ece3a8c227097cb178f7..b5dd9825ebf4714c63e7775c81546a2573473ee4 100644 (file)
@@ -17,8 +17,7 @@
 #pragma once
 
 #include <string>
-
-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);
index a696521ad6745d96d6f067019f342865ee02d74a..8b26bacf178a0a6b622c29e352183d7dfd41cfb5 100644 (file)
@@ -20,6 +20,7 @@
 #include <string_view>
 #include <boost/optional.hpp>
 #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<Compressor> CompressorRef;
-class CephContext;
 
 class Compressor {
 public:
index 2d0131c3f887ab5869d12b4deb8771440ff6e0fe..1c677ff10795784fab7f29e01317b87fb62c6ab9 100644 (file)
@@ -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
  *
index f094e335e8f9d09e90b45e730c6646627e4dda2c..13f096e3ec62b4b67c12230e0207ccda185bbd60 100644 (file)
@@ -17,6 +17,7 @@
 #include "crimson/osd/osd.h"
 
 using crimson::osd::OSD;
+using namespace crimson::common;
 
 namespace {
 seastar::logger& logger()
index be32f6f1e53d20e69d8f81db0862175e0bed802e..a196302470754f96945fe7c91bc4c807f4b54e37 100644 (file)
@@ -6,6 +6,7 @@
 #include "common/perf_counters.h"
 #include <seastar/core/sharded.hh>
 
+using crimson::common::PerfCountersCollectionImpl;
 namespace crimson::common {
 class PerfCountersCollection: public seastar::sharded<PerfCountersCollection>
 {
index c4464fc6f97c0281d6cf63dee1c92c1977788e20..03d57bb71aab6ef953a3a23ebba137fa7295d225 100644 (file)
@@ -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<AuthClientHandler> auth;
   auth.reset(AuthClientHandler::create(&cct,
                                        protocol,
index 65665f7a4d88a15b5141ce94c3da345ea79916af..1e764c9b98d7334762ea7213a70d386865fccc1d 100644 (file)
@@ -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;
 
index 3d2c91bbe1d17f51019b05ae92b33c7524703cec..e609990ad876589c3127569af0b44bb2f4026733 100644 (file)
@@ -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<CephContext>().get()};
+  const crimson::crush::CrushLocation loc{make_unique<CephContext>().get()};
   logger().info("{} crush location is {}", __func__, loc);
   string cmd = fmt::format(R"({{
     "prefix": "osd crush create-or-move",
index 1ced9b22e77d94568a5c790dd94ccf5a64935015..e5894b0734d3ae6d2c6f9f6b6f8df0ecf0a2e57a 100644 (file)
@@ -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 {
index f90e1fb54183eef0fcccdc61944e9f4ac01503f3..66ba0702714f8fc6d88ab2cb993930207cc95d31 100644 (file)
@@ -6,6 +6,7 @@
 #include <boost/intrusive_ptr.hpp>
 #include <seastar/core/future.hh>
 
+#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;
   }
 
index 34058f892bd61e2d9bdb564aa9a3d081d7c30947..c53769aa1bd0056f070d8a41ff4508df2230bf9f 100644 (file)
@@ -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 <vector>
 
+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;
 }
+
+}
index 36789bd782b5fde602da51ccd492c2985c153cdd..678135c2e42aa1bdfa0ef0fbf5a82cf44aad18fa 100644 (file)
@@ -9,8 +9,9 @@
 #include <string>
 
 #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
index 7a8825dcdc8769f7212316c6c824d0111ed1ab93..f6c2672371fc0728878073620b0fe826da5a6a3c 100644 (file)
@@ -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;
 }
+}
index 7d32d8cfa5f4340028f446b10e640d95e82b9079..9ded220541238a69472e37ec8aa554bd66c6ca62 100644 (file)
@@ -18,9 +18,9 @@
 #include <limits.h>
 
 #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
index 1c60534d3793b5a0f9d35f9f0d556e728861ecca..0afeddb12a5f9bcc31937f99765424bced6efc01 100644 (file)
@@ -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<std::string,std::string> *defaults,
 
   return boost::intrusive_ptr<CephContext>{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();
index fe6f557bb253ea139455be4c6dbdaf8bcd218348..d1d6dbbddbfb1272a507bf4c6f42d6384b1fef82 100644 (file)
@@ -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
index ccf7fb47d03bacc121b68c200ba232679359b131..3d63ee3c1622e2d32ded48d7006d100c52872332 100644 (file)
@@ -23,7 +23,7 @@
 # include "acconfig.h"
 #endif
 
-class CephContext;
+#include "include/common_fwd.h"
 
 namespace ceph {
 
index d574aee3700a1fdad719202ce07139ba22272b07..70018a2ee3357657a3c8756ab6770a140257e364 100644 (file)
 #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 (file)
index 0000000..e7ed9ca
--- /dev/null
@@ -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;
index 32680f73659b51319b75e058c0590e48c6b4e5b3..90257f767bd514e3b5ca51ffb3ce14b52a39423a 100644 (file)
 #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,
index 117b6aee88d62ebdb918bedef41980c90601e159..56fb8cb5959f84cfe9b342e519d24b189a319cd5 100644 (file)
@@ -15,6 +15,7 @@
 #include <string>
 #include <memory>
 #include <boost/scoped_ptr.hpp>
+#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,
index ab0b38330abee5c8b47622181470ab9850e38814..328277e52a34200b228d92a7f153d8d941546d78 100644 (file)
@@ -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"
index a670ce549458381417344beb654d9d3e574c2c43..6c9c3387e39dac6cd57c176b9f613ee413bf1d45 100644 (file)
 #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,
index 00520214a790b372f2e46a94f7bcccb37c066e9b..a3b8d20dfb48bc160cdfd281df3d6c994cd69590 100644 (file)
@@ -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;
index d09a368a4cc8352424e370e02074a05109fb5784..33deeb3ae8d27f2d00308061a1b72594073fb39e 100644 (file)
@@ -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"
 
index 5fe8cc3b4451aae0b060e38c49d1b44f546d8997..ecc4cdb400c56d49a826e9fb8528c83579acd17b 100644 (file)
@@ -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"
 #include <boost/lockfree/policies.hpp>
 #include <boost/lockfree/queue.hpp>
 
-class CephContext;
 class ContextWQ;
 class Finisher;
-class PerfCounters;
 class ThreadPool;
 class SafeTimer;
 
index 67507efd0e41415a4706dbc38784ed8619dde4ba..76d41e6e5102be8b579bac102a5bd9ef0320bc61 100644 (file)
@@ -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 <map>
 #include <utility>
 
-class CephContext;
 
 namespace librbd {
 
index daa718c9746681d36da56582f0609a23e7272e72..83225d287ebcac8e6667f8c75f94854ac6f4533a 100644 (file)
@@ -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;
index d1450e8d7d1e439ee16fee979e26009f7339433e..a40afaf544fddcf8d83f6e4e35c858ba045f5d62 100644 (file)
@@ -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 {
index 9a792657ba4ee7347a8d05864a0e50673909ffab..1aa06d9c3c1795c81a1898bcce277c41ad18aebd 100644 (file)
@@ -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;
index 688e5c632a28ba23a2ddfc6464fd916cd6ad653a..1b8ec77aa9ddfa66e9891ee1256dbc863a7883c0 100644 (file)
@@ -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;
 
index 8ea6e4a059d9ed3a4c7bc06a1c2f0726afa5c27c..38c4de7c69a18ce9fb7d2bd9bcf0d99e5e76aa9c 100644 (file)
@@ -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;
 
index 19e978edbbcf59e7d9c59cb47e55d6bb4d0731da..cdaaa6a32b503c6ff311aa7c8cd8959974fb9136 100644 (file)
@@ -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 <condition_variable>
 #include <mutex>
 
-class CephContext;
 
 namespace librbd {
 namespace io {
index ea62a05aabd5489806eaf27ea326be06a4bf8019..67339caec85f27d1b56dce7c6c4761f24d385bf0 100644 (file)
@@ -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 <sys/uio.h>
 #include <boost/variant/variant.hpp>
 
-struct CephContext;
 
 namespace librbd {
 
index d22044d10375892b6a2abd0f0cf0e93b45227d0a..93643f9f9ee24e0f92eca0c205c97ffd7b167689 100644 (file)
@@ -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 <list>
 
-struct CephContext;
 
 namespace librbd {
 namespace journal {
index f0d470c1b37af707a0b68f71b5328d09830aed89..d08011e852cbc5346acf0b75252400b21e0c59bc 100644 (file)
@@ -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 <string>
 
-struct CephContext;
 struct Context;
 
 namespace librbd {
index 5f65a57ce9e9a4aa23255b179c28f8c34cfe93eb..f9ac0fdb945abbbd9ecd9aa6576b52b54e18daba 100644 (file)
@@ -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 <string>
 
-class CephContext;
 class Context;
 class ContextWQ;
 
index 4e4c6e8b007f06a33a99fed97bb758b38ef941f2..feed962c8180b5244587373c85633ebcf909c329 100644 (file)
 
 #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;
 
 /**
index b3443652cb3595741fa3e43f4bf76294b94983f1..2c841481e32b0abde4ca337ed53778ed16995490 100644 (file)
@@ -19,6 +19,7 @@
 #include <thread>
 
 #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;
index cd0960a312843a2423963363ba3aca322e51a267..bb91c39e2cd717919b3d35b43a74b654058ac06d 100644 (file)
@@ -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:
index 36c7130cd22b149a76d7ff2393e7a52d043d83f3..8c5f2bff77fc9afea359b39c59edf1fc6eb14d8a 100644 (file)
@@ -19,6 +19,7 @@
 #include <string_view>
 #include <vector>
 
+#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:
index 3a7e08c86a3948842683d2783d7a349a912be056..e7b1f51001e90779b52fc08cf075db62556065ee 100644 (file)
@@ -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<MCommand> &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 {
index e9a5cd68300d7a6ad45f9e5640ded0a69cbad875..033f25bf3482b937b099142cb1f14ceb48678ddd 100644 (file)
@@ -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 {
index e9accb557908a6c91786838c1389958d9b70abc2..6c18068893d36138df16c657ece919811fec7123 100644 (file)
@@ -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,
index acb11cfaceb37a98cfc24db1bfe44c61ebb0e145..9367034b6bde1d75ad367c38cf6241740fbc5bbb 100644 (file)
@@ -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_,
index cc2c69c905e5f0d37f2d4a8240f0c5bad065c6f0..699be08c385b6d967a3d13fc499cc8a003c4b9d7 100644 (file)
 
 #include <set>
 
+#include "include/common_fwd.h"
 #include "osdc/Filer.h"
 
 class CInode;
 class MDSRank;
-class PerfCounters;
 
 class RecoveryQueue {
 public:
index 553bbd24ae040d44e06612f8503996440ca0f97c..12a9be819421d9d4c6eef8502960e7179c934d1e 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <common/DecayCounter.h>
 
+#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;
index fd64e50318cfd6082254cf07bf391bde79f78626..46335e1d472019c256d15f71a584beeff5b3b49d 100644 (file)
 #ifndef STRAY_MANAGER_H
 #define STRAY_MANAGER_H
 
+#include "include/common_fwd.h"
 #include "include/elist.h"
 #include <list>
 #include "mds/PurgeQueue.h"
 
 class MDSRank;
-class PerfCounters;
 class CInode;
 class CDentry;
 
index d9ef4eee957d7c43c3cd4ad3f51c8258f03f8f42..c1a55d880cf6084a7174c3378296ae11f40a1570 100644 (file)
@@ -22,6 +22,7 @@
 #include "mgr/OSDPerfMetricTypes.h"
 
 #include "common/perf_counters.h"
+#include "include/common_fwd.h"
 #include "mgr/DaemonHealthMetric.h"
 
 class PerfCounterType
index 88d6502749c00216d983217bbefc17f7b7dbe33d..c776acfd03b527e6b19dca6c05d6f49a25bee434 100644 (file)
@@ -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);
index 2b54a5c24025e674327e94aa96c9d1a91f7e96a9..54c016dd3469c1c032cc4666ed2925339dec5a4b 100644 (file)
@@ -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<int64_t>(g_ceph_context->_conf.get_val<double>("mon_warn_on_slow_ping_time")) * 1000;
       if (value == 0) {
index 06573211ba3c28c9cc21a7453af4bad2ec7a6e50..ac28339e953ddc4b435abdb79c433f58937f4ced 100644 (file)
@@ -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 <typename Map>
   bool map_compare(Map const &lhs, Map const &rhs) {
index 4e4bbccec85cf01fb8d38b89d4071ab028cc068c..a2ed644cdb23bbf05dfa45f3e8e83f6bf6ced8b4 100644 (file)
@@ -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()
index 9a33473f8de8e87717f6afe14a281e1c0a42e3c1..78a645bbbf08629d906ad0ca589da2292dd5fdbd 100644 (file)
@@ -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;
   }
 
index 0a78bc6ad1cce693340dc25198432a433330c6f8..a67409fe9f8c1b3e8afaae3d9d38722796f01c6d 100644 (file)
@@ -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
index 06a43c7a815a587f816a3f8eecda54d68f3db304..6581227b3b6720c1dda07017b5dd23c18c81a6c4 100644 (file)
@@ -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."
index 3e3343796fb1290454eee6df52f42373251a4ab1..26ffad6e32e656105e9e657adebf4bfe26ddca3a 100644 (file)
@@ -18,6 +18,7 @@
 #include <regex>
 
 #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
index 73f83230e5655bcd155fef3e41c28e02eff9879d..bc4206fc0cc321377f44f1bcbf63482b80dae6d5 100644 (file)
@@ -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 '"
index 00ec6284bf45aa1ed7628ffbc49e49bc53dd9ad2..230793be2335c3f8f707a024428d5bf837b489ee 100644 (file)
@@ -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 <int dblV>
index 5e4bcd98f819b92e72861b16c45450f577777725..397c3700c21d7dba08ee166b9d8b387530b9fda0 100644 (file)
@@ -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
index 5f8227f4617b49f23d954cde0ce846d163629c0e..edc1bda51a1f96b0dd2732b053119c5544ac232a 100644 (file)
@@ -6,11 +6,10 @@
 
 #include <ostream>
 
+#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
index 49acde967c5cd1ebf9799e86a6085ce864cbf65d..21f81b4f90ae470d75200fd965e455fa9b285b53 100644 (file)
 #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() << " ";
index c9522334e0fda7ff8d7369d92cacd26a342438dc..fd8b14883624fcaf8007499e2e96f6e8a378ed2f 100644 (file)
@@ -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"
index 55488ff315fdcc06bef356ba3ff9b9552d491533..9f52d5e6f7c95700a15decb2e0c37f73205cb037 100644 (file)
@@ -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()
index b4b2f5462e4432cafadc88320e895f45d48ccdac..b4cc322b9f0b5a350b544b3e33d161ac379a19fe 100644 (file)
@@ -127,7 +127,7 @@ static const string OSD_SNAP_PREFIX("osd_snap");
   -> map<int64_t,interval_set<snapid_t>>
 
   */
-
+using namespace TOPNSPC::common;
 namespace {
 
 struct OSDMemCache : public PriorityCache::PriCache {
index d838ddd50bfb9c0fb5f338b97b50493f2597808f..636ab0c7156327814c384b2e1050a9a361226d66 100644 (file)
@@ -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);
index 97969de8abe4a49354a562854afc9a1cce26726c..243de2cba02e67965c7f88df83f5560576cbbc12 100644 (file)
@@ -20,6 +20,7 @@
 #include <queue>
 #include <boost/intrusive_ptr.hpp>
 #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;
 
index 4c707da7d279c13604711849cde1b6761fa6e35d..5e025437b53570ad78844cb38e7e6c3c6bfeab74 100644 (file)
 #include <memory>
 #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 {
index de776a87e8f07141b02fdef66253de55f2b5b5f6..3af89f304fe1e4cda94e985aa28b5682ebdb7013 100644 (file)
@@ -29,6 +29,7 @@
 #include <string>
 #include <vector>
 
+#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;
index d3d13d04ba380dfbd03fa477c8f9b0ae12293281..4abd333e16f182047defa022f0a75b6e1c062041 100644 (file)
@@ -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 <sys/vfs.h>    /* or <sys/statfs.h> */
 #endif
 
-class CephContext;
-
 namespace ceph {
   class Formatter;
 }
index 0ef84b91b627aab3e17b9dc5d594e6002d403efc..750354c8a2807f2794a4b723336cd74ed87fd270 100644 (file)
@@ -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 {
index f54d9d254138cd04a44c2a6935a31aabe4a051f6..69f1bf75616647fb6b5c6cc26104ddfb8ba7fe00 100644 (file)
@@ -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);
index 86e03bbfd37ace241a4cfedbe048313bc981a38b..8045f39c44963fa4e343195f32cdbf5c08e4a619 100644 (file)
 #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 {
index 2c19ad478f0f14c9af8f35715dfddd030e18474b..fe5c15dbf0a93e43cf48443bf222bb8ad6af24ad 100644 (file)
 #include <errno.h>
 
 #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:
index a7f6e1d65005314ef28c5b938bb01f2e2ab2f4ae..ed27e222b3ecea000fd6a3fcd529398920241b8e 100644 (file)
 #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,
index cd992e082979f0e037a3d1fac19b8ac86693d73e..ac3f3c4aa3c3db85c1ca08e890e1205663af9ab4 100644 (file)
@@ -6,17 +6,15 @@
 #include <variant>
 
 #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 {
index 15197037179d2ce1826e337e3df46b69a8910a0d..71b6e3de24c4ca592c11ecf70cc7797b3e543faf 100644 (file)
 #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<void(int,const std::string&,bufferlist&)> 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;
     }
index b1dfad86f359bf5d030e51c3f615efe70fb34628..59f84ed0bf3c7cfb2abaab7b6a246f3f2b4afd2d 100644 (file)
@@ -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;
index 05eee7ef7369ae22a87be608e625eff2d898792e..a4adf503dd3921ec15561b659555d735a1c861d0 100644 (file)
@@ -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<string>& ls, set<int> *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;
index 15ce0ef7216c165c9567a546b65532ab8ddd47e4..cdbacbb1e63132bc76c533ce67020a8a96c160a1 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <boost/smart_ptr/local_shared_ptr.hpp>
 #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;
 
index fd8905cf8e8424cc5a1b509bffaed3dceccf5c75..d187c3a630c20e740045bbd488c02e68738d307d 100644 (file)
@@ -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 {
index 2990366f5df88fd2b488347fd9248ec4c13ce36f..297e89d9a40ad0e3c822e9fa6455498ba45f66bb 100644 (file)
@@ -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 <list>
@@ -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;
index 59eb5a5a4df036f2f82d5a91abe61733169a35cb..160ca0090e1b364792e017cfd0ce89ad2839f652 100644 (file)
@@ -14,6 +14,7 @@
 #include <atomic>
 
 #include "include/ceph_assert.h"
+#include "include/common_fwd.h"
 
 #include "PGLog.h"
 #include "PGStateUtils.h"
index 8e5b0c2dea93fe25a7bba8919228b40ad8d1face..bd7e822b2db384d6d4fa58c8e9162fed70546c6b 100644 (file)
@@ -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 <typename T>
 static ostream& _prefix(std::ostream *_dout, T *pg) {
   return pg->gen_prefix(*_dout);
index a1d9b2729d285e4e4215f5e2608f3ed76b790b86..ed63b4d3f6784d3355f749098a92e6e89004fe0c 100644 (file)
@@ -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);
index 47ce2efebdd4942d56b0f23a8975364ccf1072f2..9966a7f7df3c2f357d70198a0905211f6b16fe48 100644 (file)
@@ -3,6 +3,7 @@
 
 #pragma once
 
+#include "include/common_fwd.h"
 #include "common/perf_counters.h"
 
 enum {
index 4bc5afad78a303437037d0110ba534712db68bb9..3e8f0f6650b8f01f79e275891f47a4b166b5f402 100644 (file)
 
 #include "common/Timer.h"
 #include "common/Throttle.h"
+#include "include/common_fwd.h"
 
-class CephContext;
 class Context;
-class PerfCounters;
 class Finisher;
 class C_OnFinisher;
 
index 84e11f490fc84130b5e00210d46fefb92e02d246..bc6133651e934fb44099bab35a4e022787937923 100644 (file)
@@ -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,
index fa421e33cd7f7751f09cc887a8ae1329b38ecd62..8db78558901060eb095ab33b496344bc9a666703 100644 (file)
@@ -26,6 +26,7 @@
 #include <boost/thread/shared_mutex.hpp>
 
 #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;
 
 // -----------------------------------------
 
index c7dc9c224fcc321a84b9523ae0d8d9195f208c69..85b99f08fd0bde1a4257220807bf473d679f6d02 100644 (file)
 #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 {
 
index ff2b12073b332e32d5d719e8e91e39a9089b171e..bbfce2d5dcd66a293699233131ba7dd3e97fcf0b 100644 (file)
@@ -7,7 +7,7 @@
 #include <functional>
 #include <boost/smart_ptr/intrusive_ptr.hpp>
 
-class CephContext;
+#include "include/common_fwd.h"
 
 namespace rgw::amqp {
 // forward declaration of connection object
index 7ba410136f2d0e62f6802df23519fbcd7a8e373e..aeceb05099d138e9702d55c37ee8cf65e02c72cf 100644 (file)
@@ -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 <boost/asio/yield.hpp>
@@ -269,7 +270,7 @@ class RGWReadRemoteDataLogShardCR : public RGWCoroutine {
   bool *truncated;
 
   read_remote_data_log_response response;
-  std::optional<PerfGuard> timer;
+  std::optional<TOPNSPC::common::PerfGuard> timer;
 
 public:
   RGWReadRemoteDataLogShardCR(RGWDataSyncCtx *_sc, int _shard_id,
index cccdd65b6ab6487bb70bf51ce6b9ffc27bebd5af..569fb631d2bc075e25ff0f3f570f4596748a3ba3 100644 (file)
@@ -8,7 +8,7 @@
 #include <boost/smart_ptr/intrusive_ptr.hpp>
 #include <boost/optional.hpp>
 
-class CephContext;
+#include "include/common_fwd.h"
 
 namespace rgw::kafka {
 // forward declaration of connection object
index 0dc666b365ed3d847157468581594fbc6aa5ec16..64c759141518648f2667f291ad01b73f06ebaec3 100644 (file)
@@ -5,10 +5,10 @@
 
 #include <string>
 #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;
 }
index 37fe80786bc5179baa8e68c79c61b98ffac9bd3b..9037c523e9464db7d4de31a9115b63c47e07e776 100644 (file)
 
 #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;
index b6869803e71a33f911457d9e5fe5abf762d618d8..1307d36d7043b5e3e016f44f0c4c8491a67ae13b 100644 (file)
@@ -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;
 
index 4e1602915a8800c2ec8d9ccd55288fa9e3adce56..d1a852cb9ef85760e085e77b06e5b49f7f467b1d 100644 (file)
@@ -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 {
index 54f46f69c252dff6016cf12ef718cde5151e48ac..5a2f752c876b1a1d9216ff594fc4fd250a8f30a3 100644 (file)
@@ -6,13 +6,13 @@
 #include <memory>
 #include <stdexcept>
 #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;
 
index 8aa280f9def50932df780bdd51553c90ef283b75..4bfbf5f810a68c302b080b308611d1821ee317e9 100644 (file)
@@ -13,6 +13,7 @@
 #include <boost/intrusive/list.hpp>
 #include <boost/asio/basic_waitable_timer.hpp>
 
+#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;
index 0ea3827d38f29f1ccda55f08aa5cbf4986aa51e0..5cbd3579a087871a21d111d4488382badd85ff0f 100644 (file)
@@ -7,10 +7,10 @@
 #include "rgw_rest_client.h"
 #include "common/ceph_json.h"
 #include "common/RefCountedObj.h"
+#include "include/common_fwd.h"
 
 #include <atomic>
 
-class CephContext;
 class RGWSI_Zone;
 
 template <class T>
index 8d4f76b8b2ed46e2df758dd0dc93cdf7dfa70c56..c675112270fea981936218978e51dc918a956223 100644 (file)
 
 #include <memory>
 #include <boost/utility/string_view.hpp>
+#include "include/common_fwd.h"
 #include "include/encoding.h"
 #include "common/ceph_time.h"
 
-class CephContext;
 class RGWCoroutine;
 class RGWHTTPManager;
 
index c981d78b15528649726f7fdf634051396cc9157c..5df99dbecfb4628140f5afd12bda2450d48ffa5b 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "common/Thread.h"
 #include "common/ceph_mutex.h"
+#include "include/common_fwd.h"
 
-class CephContext;
 class RGWRados;
 
 class RGWRadosThread {
index fb0a9d299277970faffe56a364883686fdd0304a..eeea9c20bdbe91477859950092ae7e3f4f857773 100644 (file)
@@ -120,7 +120,7 @@ class MyTest : public AdminSocketHook {
           std::ostream& ss,
           bufferlist& result) override {
     std::vector<std::string> 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<std::string> args;
-    cmd_getval(cmdmap, "args", args);
+    TOPNSPC::common::cmd_getval(cmdmap, "args", args);
     result.append(command);
     result.append("|");
     string resultstr;
index 685621a8c75d22616c6c984b0bbe7d197f6f256a..4a6da0cc0c540415277a685d0a02cedd366544d4 100644 (file)
@@ -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 {
 
index d7a31b6c08ad8125ad81fdf5d24fb6ed8cdcb4a9..9b7612d31db1d1adf3573ae9a3c3f14fdb5b29e0 100644 (file)
@@ -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 {
 
index 8df1bda8f5c46ea5693b1df7150087d3d49b3737..8b1e0f584546f25aedc279c6c4802bec2fd40b5b 100644 (file)
@@ -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 <map>
 #include <string>
 
-struct CephContext;
 struct Context;
 namespace librbd { struct ImageCtx; }
 
index d6a55579f63dd9023ea8d3894cbb5a642a690f14..04e1848b503b0da9b8de8eb2afa8de6c82a586ac 100644 (file)
@@ -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;
index ae689de4838db3c816e33dbc94e90b08cdd506da..32080238aea22a45459750c97ed9ef9c9f415b83 100644 (file)
@@ -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; }