From: J. Eric Ivancich Date: Tue, 23 Aug 2022 20:44:24 +0000 (-0400) Subject: rgw: remove dout_subsys defs from header files X-Git-Tag: v18.0.0~145^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bccf6c30744d64d8bda9ee1764275d0b6df238c8;p=ceph.git rgw: remove dout_subsys defs from header files Each compilation unit should be able to define its own dout_subsys without generating a redefinition warning. When dout_subsys is defined in header files, it complicates this matter. This commit removes definitions and header files and makes sure definitions are added to .cc files as needed. Additionally, at Adam Emerson's suggestion, use "static constexpr" rather than "#define" to set "dout_subsys" in a few places as a reminder to ultimately do it more broadly. Signed-off-by: J. Eric Ivancich --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 843c89053935..fe5d0b74f3c3 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -73,7 +73,6 @@ extern "C" { #include "services/svc_zone.h" #define dout_context g_ceph_context -#define dout_subsys ceph_subsys_rgw #define SECRET_KEY_LEN 40 #define PUBLIC_ID_LEN 20 @@ -81,6 +80,8 @@ extern "C" { using namespace std; static rgw::sal::Store* store = NULL; +static constexpr auto dout_subsys = ceph_subsys_rgw; + static const DoutPrefixProvider* dpp() { struct GlobalPrefix : public DoutPrefixProvider { diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 1c62a68d512d..c95707741ed5 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -36,7 +36,8 @@ #include #define dout_context g_ceph_context -#define dout_subsys ceph_subsys_rgw + +static constexpr auto dout_subsys = ceph_subsys_rgw; using rgw::ARN; using rgw::IAM::Effect; diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index cb392c05ff10..03c5303ebf79 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -18,8 +18,6 @@ #include "services/svc_sys_obj.h" #include "services/svc_bucket.h" -#define dout_subsys ceph_subsys_rgw - struct rgw_http_param_pair; class RGWRESTConn; diff --git a/src/rgw/rgw_lib.h b/src/rgw/rgw_lib.h index 7713f19935fe..7336aaf4c8fb 100644 --- a/src/rgw/rgw_lib.h +++ b/src/rgw/rgw_lib.h @@ -18,8 +18,6 @@ #include "services/svc_zone_utils.h" #include "include/ceph_assert.h" -#define dout_subsys ceph_subsys_rgw - class OpsLogSink; namespace rgw { @@ -47,7 +45,7 @@ namespace rgw { rgw::LDAPHelper* get_ldh() { return ldh; } CephContext *get_cct() const override { return cct.get(); } - unsigned get_subsys() const { return dout_subsys; } + unsigned get_subsys() const { return ceph_subsys_rgw; } std::ostream& gen_prefix(std::ostream& out) const { return out << "lib rgw: "; } int init(); diff --git a/src/rgw/rgw_log.h b/src/rgw/rgw_log.h index 7cba7d1e1a7b..7cceadcf6cdf 100644 --- a/src/rgw/rgw_log.h +++ b/src/rgw/rgw_log.h @@ -11,8 +11,6 @@ #include #include "rgw_sal_fwd.h" -#define dout_subsys ceph_subsys_rgw - struct rgw_log_entry { using headers_map = boost::container::flat_map; diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index eb43f57f6c33..eb9ed5a63ef2 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -64,10 +64,10 @@ #include #endif -#define dout_subsys ceph_subsys_rgw - using namespace std; +static constexpr auto dout_subsys = ceph_subsys_rgw; + namespace { TracepointProvider::Traits rgw_op_tracepoint_traits("librgw_op_tp.so", "rgw_op_tracing"); diff --git a/src/rgw/rgw_orphan.h b/src/rgw/rgw_orphan.h index 4ecbd0e97ccd..d32406864943 100644 --- a/src/rgw/rgw_orphan.h +++ b/src/rgw/rgw_orphan.h @@ -21,8 +21,6 @@ #include "rgw_sal_rados.h" -#define dout_subsys ceph_subsys_rgw - #define RGW_ORPHAN_INDEX_OID "orphan.index" #define RGW_ORPHAN_INDEX_PREFIX "orphan.scan" diff --git a/src/rgw/rgw_process.h b/src/rgw/rgw_process.h index 964842811cf9..9fb1aaded37d 100644 --- a/src/rgw/rgw_process.h +++ b/src/rgw/rgw_process.h @@ -18,11 +18,6 @@ #include -#if !defined(dout_subsys) -#define dout_subsys ceph_subsys_rgw -#define def_dout_subsys -#endif - #define dout_context g_ceph_context extern void signal_shutdown(); @@ -198,10 +193,6 @@ extern int rgw_process_authenticated(RGWHandler_REST* handler, rgw::sal::Store* store, bool skip_retarget = false); -#if defined(def_dout_subsys) -#undef def_dout_subsys -#undef dout_subsys -#endif #undef dout_context #endif /* RGW_PROCESS_H */ diff --git a/src/rgw/rgw_sync_trace.cc b/src/rgw/rgw_sync_trace.cc index dc29cfa857ec..b4a15ecc9410 100644 --- a/src/rgw/rgw_sync_trace.cc +++ b/src/rgw/rgw_sync_trace.cc @@ -13,11 +13,13 @@ #include "rgw_rados.h" #include "rgw_worker.h" - #define dout_context g_ceph_context +static constexpr auto dout_subsys = ceph_subsys_rgw; + using namespace std; + RGWSyncTraceNode::RGWSyncTraceNode(CephContext *_cct, uint64_t _handle, const RGWSyncTraceNodeRef& _parent, const string& _type, const string& _id) : cct(_cct), diff --git a/src/rgw/rgw_worker.h b/src/rgw/rgw_worker.h index d01456172a00..eb2e55243486 100644 --- a/src/rgw/rgw_worker.h +++ b/src/rgw/rgw_worker.h @@ -1,5 +1,3 @@ - - // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab ft=cpp @@ -24,8 +22,6 @@ #include "common/ceph_mutex.h" #include "include/common_fwd.h" -#define dout_subsys ceph_subsys_rgw - class RGWRados; class RGWRadosThread { @@ -54,7 +50,7 @@ class RGWRadosThread { } CephContext *get_cct() const { return cct; } - unsigned get_subsys() const { return dout_subsys; } + unsigned get_subsys() const { return ceph_subsys_rgw; } std::ostream& gen_prefix(std::ostream& out) const { return out << "rgw rados thread: "; } }; diff --git a/src/rgw/store/dbstore/common/dbstore_log.h b/src/rgw/store/dbstore/common/dbstore_log.h index 4b1373bfccb2..8d981d5adc41 100644 --- a/src/rgw/store/dbstore/common/dbstore_log.h +++ b/src/rgw/store/dbstore/common/dbstore_log.h @@ -12,7 +12,6 @@ #include #include "common/dout.h" -#define dout_subsys ceph_subsys_rgw #undef dout_prefix #define dout_prefix *_dout << "rgw dbstore: " diff --git a/src/rgw/store/dbstore/dbstore_mgr.cc b/src/rgw/store/dbstore/dbstore_mgr.cc index e54039ccf448..6835f526bc60 100644 --- a/src/rgw/store/dbstore/dbstore_mgr.cc +++ b/src/rgw/store/dbstore/dbstore_mgr.cc @@ -6,8 +6,11 @@ #include +static constexpr auto dout_subsys = ceph_subsys_rgw; + using namespace std; + /* Given a tenant, find and return the DBStore handle. * If not found and 'create' set to true, create one * and return