summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/auth/AuthAuthorizeHandler.h2
-rw-r--r--src/auth/AuthClientHandler.h2
-rw-r--r--src/auth/AuthMethodList.h3
-rw-r--r--src/auth/AuthServer.h2
-rw-r--r--src/auth/AuthServiceHandler.h2
-rw-r--r--src/auth/AuthSessionHandler.h2
-rw-r--r--src/auth/Crypto.cc2
-rw-r--r--src/auth/Crypto.h2
-rw-r--r--src/auth/KeyRing.h3
-rw-r--r--src/auth/RotatingKeyRing.h2
-rw-r--r--src/auth/cephx/CephxAuthorizeHandler.h3
-rw-r--r--src/auth/cephx/CephxClientHandler.h2
-rw-r--r--src/auth/cephx/CephxKeyServer.h3
-rw-r--r--src/auth/cephx/CephxProtocol.h3
-rw-r--r--src/auth/cephx/CephxSessionHandler.h2
-rw-r--r--src/auth/krb/KrbClientHandler.hpp2
-rw-r--r--src/auth/none/AuthNoneAuthorizeHandler.h3
-rw-r--r--src/auth/none/AuthNoneProtocol.h3
-rw-r--r--src/auth/none/AuthNoneServiceHandler.h3
-rw-r--r--src/client/Client.h3
-rw-r--r--src/common/Finisher.h2
-rw-r--r--src/common/HeartbeatMap.h3
-rw-r--r--src/common/MemoryModel.h2
-rw-r--r--src/common/OutputDataSocket.h2
-rw-r--r--src/common/PluginRegistry.h3
-rw-r--r--src/common/RefCountedObj.cc3
-rw-r--r--src/common/RefCountedObj.h13
-rw-r--r--src/common/Timer.h2
-rw-r--r--src/common/WorkQueue.h2
-rw-r--r--src/common/admin_socket.cc1
-rw-r--r--src/common/admin_socket.h2
-rw-r--r--src/common/ceph_context.cc52
-rw-r--r--src/common/ceph_context.h22
-rw-r--r--src/common/ceph_crypto.cc29
-rw-r--r--src/common/ceph_crypto.h67
-rw-r--r--src/common/cmdparse.cc4
-rw-r--r--src/common/cmdparse.h5
-rw-r--r--src/common/common_init.h3
-rw-r--r--src/common/config.h3
-rw-r--r--src/common/config_fwd.h9
-rw-r--r--src/common/config_proxy.h3
-rw-r--r--src/common/fd.h2
-rw-r--r--src/common/lockdep.h4
-rw-r--r--src/common/mutex_debug.h4
-rw-r--r--src/common/options.cc1
-rw-r--r--src/common/perf_counters.cc3
-rw-r--r--src/common/perf_counters.h16
-rw-r--r--src/common/perf_counters_collection.cc2
-rw-r--r--src/common/perf_counters_collection.h10
-rw-r--r--src/common/pick_address.h3
-rw-r--r--src/common/random_string.h3
-rw-r--r--src/compressor/Compressor.h2
-rw-r--r--src/crimson/admin/admin_socket.cc1
-rw-r--r--src/crimson/admin/osd_admin.cc1
-rw-r--r--src/crimson/common/perf_counters_collection.h1
-rw-r--r--src/crimson/mon/MonClient.cc2
-rw-r--r--src/crimson/mon/MonClient.h2
-rw-r--r--src/crimson/osd/osd.cc4
-rw-r--r--src/crimson/osd/pg.h2
-rw-r--r--src/crimson/osd/shard_services.h6
-rw-r--r--src/crush/CrushLocation.cc5
-rw-r--r--src/crush/CrushLocation.h5
-rw-r--r--src/global/global_context.cc2
-rw-r--r--src/global/global_context.h6
-rw-r--r--src/global/global_init.cc5
-rw-r--r--src/global/global_init.h9
-rw-r--r--src/include/ceph_assert.h2
-rw-r--r--src/include/cephfs/libcephfs.h17
-rw-r--r--src/include/common_fwd.h32
-rw-r--r--src/kv/LevelDBStore.h3
-rw-r--r--src/kv/MemDB.h2
-rw-r--r--src/kv/RocksDBStore.cc1
-rw-r--r--src/kv/RocksDBStore.h2
-rw-r--r--src/librados/RadosClient.h2
-rw-r--r--src/librados/snap_set_diff.h2
-rw-r--r--src/librbd/ImageCtx.h3
-rw-r--r--src/librbd/TaskFinisher.h2
-rw-r--r--src/librbd/api/Config.h4
-rw-r--r--src/librbd/image/AttachChildRequest.h2
-rw-r--r--src/librbd/image/CloneRequest.h4
-rw-r--r--src/librbd/image/CreateRequest.h2
-rw-r--r--src/librbd/image/ValidatePoolRequest.h2
-rw-r--r--src/librbd/io/AioCompletion.h2
-rw-r--r--src/librbd/io/ReadResult.h2
-rw-r--r--src/librbd/journal/Utils.h2
-rw-r--r--src/librbd/trash/MoveRequest.h2
-rw-r--r--src/librbd/trash/RemoveRequest.h2
-rw-r--r--src/mds/FSMap.h2
-rw-r--r--src/mds/MDCache.h3
-rw-r--r--src/mds/MDLog.h3
-rw-r--r--src/mds/MDSAuthCaps.h3
-rw-r--r--src/mds/MDSDaemon.cc6
-rw-r--r--src/mds/MDSMap.h2
-rw-r--r--src/mds/MDSRank.cc2
-rw-r--r--src/mds/MDSRank.h4
-rw-r--r--src/mds/RecoveryQueue.h2
-rw-r--r--src/mds/Server.h3
-rw-r--r--src/mds/StrayManager.h2
-rw-r--r--src/messages/MMgrReport.h1
-rw-r--r--src/mgr/ActivePyModule.cc2
-rw-r--r--src/mgr/ClusterState.cc4
-rw-r--r--src/mgr/DaemonServer.cc2
-rw-r--r--src/mon/AuthMonitor.cc1
-rw-r--r--src/mon/ConfigKeyService.cc3
-rw-r--r--src/mon/ConfigMonitor.cc1
-rw-r--r--src/mon/FSCommands.cc1
-rw-r--r--src/mon/HealthMonitor.cc2
-rw-r--r--src/mon/LogMonitor.cc2
-rw-r--r--src/mon/MDSMonitor.cc5
-rw-r--r--src/mon/MgrMonitor.cc1
-rw-r--r--src/mon/MonCap.h3
-rw-r--r--src/mon/Monitor.cc1
-rw-r--r--src/mon/Monitor.h2
-rw-r--r--src/mon/MonmapMonitor.cc1
-rw-r--r--src/mon/OSDMonitor.cc2
-rw-r--r--src/mon/PGMap.cc1
-rw-r--r--src/msg/DispatchQueue.h2
-rw-r--r--src/msg/Dispatcher.h2
-rw-r--r--src/msg/async/rdma/Infiniband.h2
-rw-r--r--src/os/ObjectStore.h3
-rw-r--r--src/os/bluestore/BlockDevice.h2
-rw-r--r--src/os/bluestore/BlueFS.cc2
-rw-r--r--src/os/bluestore/BlueFS.h3
-rw-r--r--src/os/filestore/Journal.h2
-rw-r--r--src/os/filestore/WBThrottle.h2
-rw-r--r--src/osd/ClassHandler.h4
-rw-r--r--src/osd/OSD.cc7
-rw-r--r--src/osd/OSD.h3
-rw-r--r--src/osd/OSDMap.cc3
-rw-r--r--src/osd/OSDMap.h2
-rw-r--r--src/osd/PG.h2
-rw-r--r--src/osd/PGLog.h3
-rw-r--r--src/osd/PeeringState.h1
-rw-r--r--src/osd/PrimaryLogPG.cc2
-rw-r--r--src/osd/osd_perf_counters.cc2
-rw-r--r--src/osd/osd_perf_counters.h1
-rw-r--r--src/osdc/Journaler.h3
-rw-r--r--src/osdc/ObjectCacher.h3
-rw-r--r--src/osdc/Objecter.h2
-rw-r--r--src/osdc/Striper.h2
-rw-r--r--src/rgw/rgw_amqp.h2
-rw-r--r--src/rgw/rgw_data_sync.cc3
-rw-r--r--src/rgw/rgw_kafka.h2
-rw-r--r--src/rgw/rgw_notify.h2
-rw-r--r--src/rgw/rgw_object_expirer_core.h2
-rw-r--r--src/rgw/rgw_perf_counters.h4
-rw-r--r--src/rgw/rgw_period_puller.h2
-rw-r--r--src/rgw/rgw_pubsub_push.h2
-rw-r--r--src/rgw/rgw_reshard.h2
-rw-r--r--src/rgw/rgw_rest_conn.h2
-rw-r--r--src/rgw/rgw_trim_bilog.h2
-rw-r--r--src/rgw/rgw_worker.h2
-rw-r--r--src/test/admin_socket.cc4
-rw-r--r--src/test/librados_test_stub/MockTestMemCluster.h2
-rw-r--r--src/test/librados_test_stub/TestCluster.h3
-rw-r--r--src/tools/rbd_mirror/ServiceDaemon.h2
-rw-r--r--src/tools/rbd_mirror/Threads.h2
-rw-r--r--src/tools/rbd_mirror/Throttler.h2
158 files changed, 358 insertions, 285 deletions
diff --git a/src/auth/AuthAuthorizeHandler.h b/src/auth/AuthAuthorizeHandler.h
index b6ac1b1b7d2..fc4a8788628 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 01de454e854..3e2f73db049 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 b5aae0bba49..e139218d35f 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 <list>
#include <set>
#include <string>
-class CephContext;
-
class AuthMethodList {
std::list<__u32> auth_supported;
public:
diff --git a/src/auth/AuthServer.h b/src/auth/AuthServer.h
index 80b4e2114df..d7ca304a6f1 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 <vector>
-class CephContext;
class Connection;
class AuthServer {
diff --git a/src/auth/AuthServiceHandler.h b/src/auth/AuthServiceHandler.h
index ed2c532f028..ac33eaa2425 100644
--- a/src/auth/AuthServiceHandler.h
+++ b/src/auth/AuthServiceHandler.h
@@ -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;
diff --git a/src/auth/AuthSessionHandler.h b/src/auth/AuthSessionHandler.h
index 6e54f1cee00..692ebc28894 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 f8ac5372f6a..e45946341ac 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 dc03dfe4483..3691d97feee 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 <string>
-class CephContext;
class CryptoKeyContext;
namespace ceph { class Formatter; }
diff --git a/src/auth/KeyRing.h b/src/auth/KeyRing.h
index d5fe7fabbd4..5524cb79282 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<EntityName, EntityAuth> keys;
diff --git a/src/auth/RotatingKeyRing.h b/src/auth/RotatingKeyRing.h
index 04277a8be85..534eb513608 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 c53af021b89..b72b7c5e9cc 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 cd1196a689c..6b225e4aca3 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 cd3cf123467..59cd6932567 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 ebee32239e2..6c2d53a0951 100644
--- a/src/auth/cephx/CephxProtocol.h
+++ b/src/auth/cephx/CephxProtocol.h
@@ -34,8 +34,7 @@
#include <errno.h>
#include <sstream>
-class CephContext;
-
+#include "include/common_fwd.h"
/*
* Authentication
*/
diff --git a/src/auth/cephx/CephxSessionHandler.h b/src/auth/cephx/CephxSessionHandler.h
index 6a6a99f1842..e09426f1a6c 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 a8960a8898c..9ab26a6905d 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 <gssapi/gssapi_ext.h>
-class CephContext;
class Keyring;
diff --git a/src/auth/none/AuthNoneAuthorizeHandler.h b/src/auth/none/AuthNoneAuthorizeHandler.h
index d9abc769ef4..46586418980 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 2a501efe525..ea0b731f571 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 038c75e03be..d8cc13ae598 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 2648390ea27..0ec989db267 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 3b6f9e45523..f1060b0e4bf 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 28e16662d3f..65f8f94e978 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 dc529b387b3..ee87c6f3bb5 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 682dfcc6cb6..5a6bc4ff9fc 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 62020a963a8..938fb6e1687 100644
--- a/src/common/PluginRegistry.h
+++ b/src/common/PluginRegistry.h
@@ -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();
diff --git a/src/common/RefCountedObj.cc b/src/common/RefCountedObj.cc
index e77b631d89e..e4c3fef588c 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 5c0473c9598..49f29dcf842 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 <atomic>
@@ -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<RefCountedObject>;
+}
+using RefCountedPtr = ceph::ref_t<TOPNSPC::common::RefCountedObject>;
#endif
diff --git a/src/common/Timer.h b/src/common/Timer.h
index a2e979f363a..61dad464b47 100644
--- a/src/common/Timer.h
+++ b/src/common/Timer.h
@@ -16,10 +16,10 @@
#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;
diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h
index c687f52c57a..21e9669bfb4 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 8fa120fe7e8..1f57ca0832f 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 607dfc257a9..fad3e556fb9 100644
--- a/src/common/admin_socket.h
+++ b/src/common/admin_socket.h
@@ -26,11 +26,11 @@
#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;
diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc
index 976b2cfbf90..38903342941 100644
--- a/src/common/ceph_context.cc
+++ b/src/common/ceph_context.cc
@@ -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
diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h
index 6b6e9482b99..88f94ff7228 100644
--- a/src/common/ceph_context.h
+++ b/src/common/ceph_context.h
@@ -25,6 +25,7 @@
#include <typeinfo>
#include <typeindex>
+#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<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
diff --git a/src/common/ceph_crypto.cc b/src/common/ceph_crypto.cc
index 1b6d318b090..cbeb1b06df6 100644
--- a/src/common/ceph_crypto.cc
+++ b/src/common/ceph_crypto.cc
@@ -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);
}
+
+}
diff --git a/src/common/ceph_crypto.h b/src/common/ceph_crypto.h
index 75464d409bd..6bf344aa8f1 100644
--- a/src/common/ceph_crypto.h
+++ b/src/common/ceph_crypto.h
@@ -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)
{
diff --git a/src/common/cmdparse.cc b/src/common/cmdparse.cc
index 598d95b5733..a19041845e1 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 424ac812d7d..2f9e85acf90 100644
--- a/src/common/cmdparse.h
+++ b/src/common/cmdparse.h
@@ -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
diff --git a/src/common/common_init.h b/src/common/common_init.h
index 175dc5df672..b9e1417396a 100644
--- a/src/common/common_init.h
+++ b/src/common/common_init.h
@@ -17,10 +17,9 @@
#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,
diff --git a/src/common/config.h b/src/common/config.h
index b9765f86e1d..e07993701ef 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 c7e4c3f02a0..f29a1324cb9 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 0e3501aac32..025f0a0a3bf 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 581e1b0a247..718d5929609 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 11f21f56045..240347d02e3 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 551e284c3ac..4a0c2cbb447 100644
--- a/src/common/mutex_debug.h
+++ b/src/common/mutex_debug.h
@@ -21,14 +21,12 @@
#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 {
diff --git a/src/common/options.cc b/src/common/options.cc
index 45b8e527f39..a5069568a40 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 <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <regex>
diff --git a/src/common/perf_counters.cc b/src/common/perf_counters.cc
index 36105b0e6b9..dda589e1ca9 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 8936468d910..1f9391137e8 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<PerfHistogram<>> 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 c8a7ec0114c..d9af8a945bb 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 53a8f34120e..e4bd2cda3b0 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<PerfCounters, PerfCountersDeleter>;
-
-
+}
+using PerfCountersRef = std::unique_ptr<ceph::common::PerfCounters, ceph::common::PerfCountersDeleter>;
diff --git a/src/common/pick_address.h b/src/common/pick_address.h
index aa87e7c51eb..2621fed8108 100644
--- a/src/common/pick_address.h
+++ b/src/common/pick_address.h
@@ -6,7 +6,8 @@
#include <string>
#include <list>
-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 87c1644c0f2..b5dd9825ebf 100644
--- a/src/common/random_string.h
+++ b/src/common/random_string.h
@@ -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);
diff --git a/src/compressor/Compressor.h b/src/compressor/Compressor.h
index a696521ad67..8b26bacf178 100644
--- a/src/compressor/Compressor.h
+++ b/src/compressor/Compressor.h
@@ -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:
diff --git a/src/crimson/admin/admin_socket.cc b/src/crimson/admin/admin_socket.cc
index 2d0131c3f88..1c677ff1079 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 f094e335e8f..13f096e3ec6 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 be32f6f1e53..a1963024707 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 <seastar/core/sharded.hh>
+using crimson::common::PerfCountersCollectionImpl;
namespace crimson::common {
class PerfCountersCollection: public seastar::sharded<PerfCountersCollection>
{
diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc
index c4464fc6f97..03d57bb71aa 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<AuthClientHandler> auth;
auth.reset(AuthClientHandler::create(&cct,
protocol,
diff --git a/src/crimson/mon/MonClient.h b/src/crimson/mon/MonClient.h
index 65665f7a4d8..1e764c9b98d 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 3d2c91bbe1d..e609990ad87 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<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",
diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h
index 1ced9b22e77..e5894b0734d 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 f90e1fb5418..66ba0702714 100644
--- a/src/crimson/osd/shard_services.h
+++ b/src/crimson/osd/shard_services.h
@@ -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;
}
diff --git a/src/crush/CrushLocation.cc b/src/crush/CrushLocation.cc
index 34058f892bd..c53769aa1bd 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 <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;
}
+
+}
diff --git a/src/crush/CrushLocation.h b/src/crush/CrushLocation.h
index 36789bd782b..678135c2e42 100644
--- a/src/crush/CrushLocation.h
+++ b/src/crush/CrushLocation.h
@@ -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
diff --git a/src/global/global_context.cc b/src/global/global_context.cc
index 7a8825dcdc8..f6c2672371f 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 7d32d8cfa5f..9ded2205412 100644
--- a/src/global/global_context.h
+++ b/src/global/global_context.h
@@ -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
diff --git a/src/global/global_init.cc b/src/global/global_init.cc
index 1c60534d379..0afeddb12a5 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<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();
diff --git a/src/global/global_init.h b/src/global/global_init.h
index fe6f557bb25..d1d6dbbddbf 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 ccf7fb47d03..3d63ee3c162 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 d574aee3700..70018a2ee33 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 00000000000..e7ed9cae6a3
--- /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 32680f73659..90257f767bd 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 117b6aee88d..56fb8cb5959 100644
--- a/src/kv/MemDB.h
+++ b/src/kv/MemDB.h
@@ -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,
diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc
index ab0b38330ab..328277e52a3 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 a670ce54945..6c9c3387e39 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 00520214a79..a3b8d20dfb4 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 d09a368a4cc..33deeb3ae8d 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 5fe8cc3b445..ecc4cdb400c 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 <boost/lockfree/policies.hpp>
#include <boost/lockfree/queue.hpp>
-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 67507efd0e4..76d41e6e510 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 <map>
#include <utility>
-class CephContext;
namespace librbd {
diff --git a/src/librbd/api/Config.h b/src/librbd/api/Config.h
index daa718c9746..83225d287eb 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 d1450e8d7d1..a40afaf544f 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 9a792657ba4..1aa06d9c3c1 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 688e5c632a2..1b8ec77aa9d 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 8ea6e4a059d..38c4de7c69a 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 19e978edbbc..cdaaa6a32b5 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 <condition_variable>
#include <mutex>
-class CephContext;
namespace librbd {
namespace io {
diff --git a/src/librbd/io/ReadResult.h b/src/librbd/io/ReadResult.h
index ea62a05aabd..67339caec85 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 <sys/uio.h>
#include <boost/variant/variant.hpp>
-struct CephContext;
namespace librbd {
diff --git a/src/librbd/journal/Utils.h b/src/librbd/journal/Utils.h
index d22044d1037..93643f9f9ee 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 <list>
-struct CephContext;
namespace librbd {
namespace journal {
diff --git a/src/librbd/trash/MoveRequest.h b/src/librbd/trash/MoveRequest.h
index f0d470c1b37..d08011e852c 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 <string>
-struct CephContext;
struct Context;
namespace librbd {
diff --git a/src/librbd/trash/RemoveRequest.h b/src/librbd/trash/RemoveRequest.h
index 5f65a57ce9e..f9ac0fdb945 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 <string>
-class CephContext;
class Context;
class ContextWQ;
diff --git a/src/mds/FSMap.h b/src/mds/FSMap.h
index 4e4c6e8b007..feed962c818 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 b3443652cb3..2c841481e32 100644
--- a/src/mds/MDCache.h
+++ b/src/mds/MDCache.h
@@ -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;
diff --git a/src/mds/MDLog.h b/src/mds/MDLog.h
index cd0960a3128..bb91c39e2cd 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 36c7130cd22..8c5f2bff77f 100644
--- a/src/mds/MDSAuthCaps.h
+++ b/src/mds/MDSAuthCaps.h
@@ -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:
diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc
index 3a7e08c86a3..e7b1f51001e 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<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 {
diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h
index e9a5cd68300..033f25bf348 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 e9accb55790..6c18068893d 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 acb11cfaceb..9367034b6bd 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 cc2c69c905e..699be08c385 100644
--- a/src/mds/RecoveryQueue.h
+++ b/src/mds/RecoveryQueue.h
@@ -19,11 +19,11 @@
#include <set>
+#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 553bbd24ae0..12a9be81942 100644
--- a/src/mds/Server.h
+++ b/src/mds/Server.h
@@ -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;
diff --git a/src/mds/StrayManager.h b/src/mds/StrayManager.h
index fd64e50318c..46335e1d472 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 <list>
#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 d9ef4eee957..c1a55d880cf 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 88d6502749c..c776acfd03b 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 2b54a5c2402..54c016dd346 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<int64_t>(g_ceph_context->_conf.get_val<double>("mon_warn_on_slow_ping_time")) * 1000;
if (value == 0) {
diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc
index 06573211ba3..ac28339e953 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 <typename Map>
bool map_compare(Map const &lhs, Map const &rhs) {
diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc
index 4e4bbccec85..a2ed644cdb2 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 9a33473f8de..78a645bbbf0 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 0a78bc6ad1c..a67409fe9f8 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 06a43c7a815..6581227b3b6 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 3e3343796fb..26ffad6e32e 100644
--- a/src/mon/HealthMonitor.cc
+++ b/src/mon/HealthMonitor.cc
@@ -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
diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc
index 73f83230e56..bc4206fc0cc 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 00ec6284bf4..230793be233 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 <int dblV>
diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc
index 5e4bcd98f81..397c3700c21 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 5f8227f4617..edc1bda51a1 100644
--- a/src/mon/MonCap.h
+++ b/src/mon/MonCap.h
@@ -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
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index 49acde967c5..21f81b4f90a 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 c9522334e0f..fd8b1488362 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 55488ff315f..9f52d5e6f7c 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 b4b2f5462e4..b4cc322b9f0 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -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 {
diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc
index d838ddd50bf..636ab0c7156 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 97969de8abe..243de2cba02 100644
--- a/src/msg/DispatchQueue.h
+++ b/src/msg/DispatchQueue.h
@@ -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;
diff --git a/src/msg/Dispatcher.h b/src/msg/Dispatcher.h
index 4c707da7d27..5e025437b53 100644
--- a/src/msg/Dispatcher.h
+++ b/src/msg/Dispatcher.h
@@ -19,12 +19,12 @@
#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 {
diff --git a/src/msg/async/rdma/Infiniband.h b/src/msg/async/rdma/Infiniband.h
index de776a87e8f..3af89f304fe 100644
--- a/src/msg/async/rdma/Infiniband.h
+++ b/src/msg/async/rdma/Infiniband.h
@@ -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;
diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h
index d3d13d04ba3..4abd333e16f 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 <sys/vfs.h> /* or <sys/statfs.h> */
#endif
-class CephContext;
-
namespace ceph {
class Formatter;
}
diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h
index 0ef84b91b62..750354c8a28 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 f54d9d25413..69f1bf75616 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 86e03bbfd37..8045f39c449 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 2c19ad478f0..fe5c15dbf0a 100644
--- a/src/os/filestore/Journal.h
+++ b/src/os/filestore/Journal.h
@@ -19,13 +19,13 @@
#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:
diff --git a/src/os/filestore/WBThrottle.h b/src/os/filestore/WBThrottle.h
index a7f6e1d6500..ed27e222b3e 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 cd992e08297..ac3f3c4aa3c 100644
--- a/src/osd/ClassHandler.h
+++ b/src/osd/ClassHandler.h
@@ -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 {
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 15197037179..71b6e3de24c 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<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;
}
diff --git a/src/osd/OSD.h b/src/osd/OSD.h
index b1dfad86f35..59f84ed0bf3 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 05eee7ef736..a4adf503dd3 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<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;
diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h
index 15ce0ef7216..cdbacbb1e63 100644
--- a/src/osd/OSDMap.h
+++ b/src/osd/OSDMap.h
@@ -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;
diff --git a/src/osd/PG.h b/src/osd/PG.h
index fd8905cf8e8..d187c3a630c 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 2990366f5df..297e89d9a40 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 <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;
diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h
index 59eb5a5a4df..160ca0090e1 100644
--- a/src/osd/PeeringState.h
+++ b/src/osd/PeeringState.h
@@ -14,6 +14,7 @@
#include <atomic>
#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 8e5b0c2dea9..bd7e822b2db 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 <typename T>
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 a1d9b2729d2..ed63b4d3f67 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 47ce2efebdd..9966a7f7df3 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 4bc5afad78a..3e8f0f6650b 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 84e11f490fc..bc6133651e9 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 fa421e33cd7..8db78558901 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -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;
// -----------------------------------------
diff --git a/src/osdc/Striper.h b/src/osdc/Striper.h
index c7dc9c224fc..85b99f08fd0 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 ff2b12073b3..bbfce2d5dcd 100644
--- a/src/rgw/rgw_amqp.h
+++ b/src/rgw/rgw_amqp.h
@@ -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
diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc
index 7ba410136f2..aeceb05099d 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 <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,
diff --git a/src/rgw/rgw_kafka.h b/src/rgw/rgw_kafka.h
index cccdd65b6ab..569fb631d2b 100644
--- a/src/rgw/rgw_kafka.h
+++ b/src/rgw/rgw_kafka.h
@@ -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
diff --git a/src/rgw/rgw_notify.h b/src/rgw/rgw_notify.h
index 0dc666b365e..64c75914151 100644
--- a/src/rgw/rgw_notify.h
+++ b/src/rgw/rgw_notify.h
@@ -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;
}
diff --git a/src/rgw/rgw_object_expirer_core.h b/src/rgw/rgw_object_expirer_core.h
index 37fe80786bc..9037c523e94 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 b6869803e71..1307d36d704 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 4e1602915a8..d1a852cb9ef 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 54f46f69c25..5a2f752c876 100644
--- a/src/rgw/rgw_pubsub_push.h
+++ b/src/rgw/rgw_pubsub_push.h
@@ -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;
diff --git a/src/rgw/rgw_reshard.h b/src/rgw/rgw_reshard.h
index 8aa280f9def..4bfbf5f810a 100644
--- a/src/rgw/rgw_reshard.h
+++ b/src/rgw/rgw_reshard.h
@@ -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;
diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h
index 0ea3827d38f..5cbd3579a08 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 <atomic>
-class CephContext;
class RGWSI_Zone;
template <class T>
diff --git a/src/rgw/rgw_trim_bilog.h b/src/rgw/rgw_trim_bilog.h
index 8d4f76b8b2e..c675112270f 100644
--- a/src/rgw/rgw_trim_bilog.h
+++ b/src/rgw/rgw_trim_bilog.h
@@ -19,10 +19,10 @@
#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;
diff --git a/src/rgw/rgw_worker.h b/src/rgw/rgw_worker.h
index c981d78b155..5df99dbecfb 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 fb0a9d29927..eeea9c20bdb 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<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;
diff --git a/src/test/librados_test_stub/MockTestMemCluster.h b/src/test/librados_test_stub/MockTestMemCluster.h
index 685621a8c75..4a6da0cc0c5 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 d7a31b6c08a..9b7612d31db 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 8df1bda8f5c..8b1e0f58454 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 <map>
#include <string>
-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 d6a55579f63..04e1848b503 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 ae689de4838..32080238aea 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; }