]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: remove dout_subsys defs from header files
authorJ. Eric Ivancich <ivancich@redhat.com>
Tue, 23 Aug 2022 20:44:24 +0000 (16:44 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Tue, 30 Aug 2022 17:04:32 +0000 (13:04 -0400)
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 <ivancich@redhat.com>
12 files changed:
src/rgw/rgw_admin.cc
src/rgw/rgw_common.cc
src/rgw/rgw_cr_rados.h
src/rgw/rgw_lib.h
src/rgw/rgw_log.h
src/rgw/rgw_main.cc
src/rgw/rgw_orphan.h
src/rgw/rgw_process.h
src/rgw/rgw_sync_trace.cc
src/rgw/rgw_worker.h
src/rgw/store/dbstore/common/dbstore_log.h
src/rgw/store/dbstore/dbstore_mgr.cc

index 843c890539351fc86adbf8eb6807a79745a5e884..fe5d0b74f3c35a5d07556b71de8c6e21b907070e 100644 (file)
@@ -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 {
index 1c62a68d512db61e608cbaef938d4c943e4f78e2..c95707741ed5128c7fcc6ac0c209e43a7f6a7443 100644 (file)
@@ -36,7 +36,8 @@
 #include <sstream>
 
 #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;
index cb392c05ff104801af9347dce006fcad3d6043ed..03c5303ebf79e86f4a53973c0c4a60edf13e2352 100644 (file)
@@ -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;
 
index 7713f19935fe88cbd956424d61201eaa8234bca8..7336aaf4c8fb27317d391a80e51fa6efa6480848 100644 (file)
@@ -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();
index 7cba7d1e1a7bd2b123c59061ff4c39242a079bc8..7cceadcf6cdfba6c00c696b82219676364b83101 100644 (file)
@@ -11,8 +11,6 @@
 #include <fstream>
 #include "rgw_sal_fwd.h"
 
-#define dout_subsys ceph_subsys_rgw
-
 struct rgw_log_entry {
 
   using headers_map = boost::container::flat_map<std::string, std::string>;
index eb43f57f6c33e5696f714eb348e34cb793767d1a..eb9ed5a63ef200bf7cffb71bcb1eb836657a4e74 100644 (file)
 #include <sys/prctl.h>
 #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");
index 4ecbd0e97ccd5e73500058fe7166292bf70d6e4e..d32406864943cfb16deabb16c1acfbfd6f5a15c9 100644 (file)
@@ -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"
 
index 964842811cf9ed641685a35d6e9ae4f0f2c51fd7..9fb1aaded37dcb50a0967a0ce9b66df9d9ef6210 100644 (file)
 
 #include <atomic>
 
-#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 */
index dc29cfa857ec0b1b71d978fd7a938efcc2ac5aea..b4a15ecc9410c5a01d17d8e71dcebcae33585c2c 100644 (file)
 #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),
index d01456172a00e9171321efc38104c034a6759ba3..eb2e55243486f2f604f25cc37d69e773103c60ac 100644 (file)
@@ -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: "; }
 
   };
index 4b1373bfccb2664d4d8c0464d8179e811f02a2bb..8d981d5adc41980d757677b47f1b9212f12aba90 100644 (file)
@@ -12,7 +12,6 @@
 #include <fstream>
 #include "common/dout.h"
 
-#define dout_subsys ceph_subsys_rgw
 #undef dout_prefix
 #define dout_prefix *_dout << "rgw dbstore: "
 
index e54039ccf448aa11e9564d5d204fe4b139d73c50..6835f526bc60ea17ec246fc2e5a9943884b3e3c0 100644 (file)
@@ -6,8 +6,11 @@
 
 #include <filesystem>
 
+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